Sample Questions Best site for GRE, LSAT, SAT, GMAT, TOEFL, CCNA, CCSA and interview sample questions  

Technical Sample Questions : C |  C++ |  Oracle |  Java | Unix |  Operating Systems |  Data Structure

Java Sample Questions ›› Java Database Sample Questions

Technical Java Sample Questions : Java Database Sample Questions

  1. How do you handle your own transaction ?

    Answer: Connection Object has a method called setAutocommit(Boolean istrue)- Default is true. Set the Parameter to false , and begin your transaction.

  2. What is the normal procedure followed by a java client to access the db?

    Answer: The database connection is created in 3 steps:

    • Find a proper database URL.
    • Load the database driver.
    • Ask the Java DriverManager class to open a connection to your database.

    In java code, the steps are realized in code as follows:

    • Create a properly formatted JDBR URL for your database.
      A JDBC URL has the formjdbc:someSubProtocol://myDatabaseServer/theDatabaseName
    • Class.forName("my.database.driver");
    • Connection conn = DriverManager.getConnection("a.JDBC.URL", "databaseLogin","databasePassword");

  3. What is a data source?

    Answer: A DataSource class brings another level of abstraction than directly using a connection object. Data source can be referenced by JNDI. Data Source may point to RDBMS, file System , any DBMS etc.

  4. What are collection pools? What are the advantages?

    Answer: A connection pool is a cache of database connections that is maintained in memory, so that the connections may be reused.

  5. How do you get Column names only for a table (SQL Server)? Write the Query.

    Answer: select name from syscolumns
    where id=(select id from sysobjects where name='user_hdr')
    order by colid --user_hdr is the table name

  6. Why does the ODBC driver manager return 'Data source name not found and no default driver specified Vendor: 0'

    Answer: This type of error occurs during an attempt to connect to a database with the bridge. First, note that the error is coming from the ODBC driver manager. This indicates that the bridge-which is a normal ODBC client-has successfully called ODBC, so the problem isn't due to native libraries not being present. In this case, it appears that the error is due to the fact that an ODBC DSN (data source name) needs to be configured on the client machine. Developers often forget to do this, thinking that the bridge will magically find the DSN they configured on their remote server machine

  7. Are all the required JDBC drivers to establish connectivity to my database part of the JDK?

    Answer: No. There aren't any JDBC technology-enabled drivers bundled with the JDK 1.1.x or Java 2 Platform releases other than the JDBC-ODBC Bridge. So, developers need to get a driver and install it before they can connect to a database. We are considering bundling JDBC technology- enabled drivers in the future.

  8. Is the JDBC-ODBC Bridge multi-threaded?

    Answer: No. The JDBC-ODBC Bridge does not support concurrent access from different threads. The JDBC-ODBC Bridge uses synchronized methods to serialize all of the calls that it makes to ODBC. Multi-threaded Java programs may use the Bridge, but they won't get the advantages of multi-threading. In addition, deadlocks can occur between locks held in the database and the semaphore used by the Bridge. We are thinking about removing the synchronized methods in the future. They were added originally to make things simple for folks writing Java programs that use a single-threaded ODBC driver.

  9. Does the JDBC-ODBC Bridge support multiple concurrent open statements per connection?

    Answer: No. You can open only one Statement object per connection when you are using the JDBC-ODBC Bridge.

  10. Why can't any one invoke the ResultSet methods afterLast and beforeFirst when the method next works?

    Answer: You are probably using a driver implemented for the JDBC 1.0 API. You need to upgrade to a JDBC 2.0 driver that implements scrollable result sets. Also be sure that your code has created scrollable result sets and that the DBMS you are using supports them.

« Previous || Next »

Java Database Sample Question Number : 1-10| 11-20| 21-30| 31-32
Sample Test Questions
GRE Sample Questions
CAT Sample Questions
GMAT Sample Questions
TOEFL Sample Questions
ACT Sample Questions
SAT Sample Questions
LSAT Sample Questions
PSAT Sample Questions
MCAT Sample Questions
PMP Sample Questions
GED Sample Questions
ECDL Sample Questions
DMV Sample Questions
CCNA Sample Questions
MCSE Sample Questions
Network+ Sample Questions
A+ Sample Questions
Technical Sample Questions
WASL Sample Questions
CISA Sample Questions

Other Sample Questions
Sample Interview Questions
Sample Teacher Interview Questions
Sample Citizenship Questions
Accuplacer Sample Questions
Science Bowl sample Questions
Driving Test Sample Questions
Sample Survey Questions Sample Essay Questions
Sample Behavioral Interview Questions

Copyright © 2004-2013, Best BSQ. All Rights Reserved.