Category Archives: Java JDBC Interview Questions

There is a method getColumnCount in the JDBC API. Is there a similar method to find the number of rows in a result set? | Java JDBC Questions

No, but it is easy to find the number of rows. If you are using a scrollable result set, rs, you can call the methods rs.last and then rs.getRow to find out how many rows rs has. If the result … Continue reading

Posted in Java JDBC Interview Questions | Leave a comment

What is the fastest type of JDBC driver? | Java JDBC Questions

JDBC driver performance will depend on a number of issues: (a) the quality of the driver code, (b) the size of the driver code, (c) the database server and its load, (d) network topology, (e) the number of times your … Continue reading

Posted in Java JDBC Interview Questions | Leave a comment

How many types of JDBC Drivers are present and what are they? | Java JDBC Questions

There are 4 types of JDBC Drivers: Type 1: JDBC-ODBC Bridge Driver Type 2: Native API Partly Java Driver Type 3: Network protocol Driver Type 4: JDBC Net pure Java Driver

Posted in Java JDBC Interview Questions | Leave a comment

How can I retrieve a String or other object type without creating a new object each time? | Java JDBC Questions

Creating and garbage collecting potentially large numbers of objects (millions) unnecessarily can really hurt performance. It may be better to provide a way to retrieve data like strings using the JDBC API without always allocating a new object. We are … Continue reading

Posted in Java JDBC Interview Questions | Leave a comment

Why can’t I invoke the ResultSet methods afterLast and beforeFirst when the method next works? | Java JDBC Questions

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 … Continue reading

Posted in Java JDBC Interview Questions | Leave a comment

What is the query used to display all tables names in SQL Server (Query analyzer)? | Java JDBC Questions

select * from information_schema.tables

Posted in Java JDBC Interview Questions | Leave a comment

Does the JDBC-ODBC Bridge support multiple concurrent open statements per connection? | Java JDBC Questions

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

Posted in Java JDBC Interview Questions | Leave a comment

Is the JDBC-ODBC Bridge multi-threaded? | Java JDBC Questions

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 … Continue reading

Posted in Java JDBC Interview Questions | Leave a comment

Are all the required JDBC drivers to establish connectivity to my database part of the JDK? | Java JDBC Questions

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 … Continue reading

Posted in Java JDBC Interview Questions | Leave a comment

Which type of JDBC driver is the fastest one? | Java JDBC Questions

JDBC Net pure Java driver(Type IV) is the fastest driver because it converts the jdbc calls into vendor specific protocol calls and it directly interacts with the database.

Posted in Java JDBC Interview Questions | Leave a comment