Free Jobs

click here

click here
JDBC Interview Questions(Basic)

For more advanced and tough JDBC Interview Questions Click Here

Q1. What is JDBC?
JDBC stands for Java Database Connectivity.It is a J2EE API that provides cross-Database connectivity to a wide range of SQL databases.With a JDBC technology enabled driver we can connect to all corporate data even if it is in a heterogeneous environment.

Q2. Explain JDBC Driver?
The JDBC Driver provides specific implementations of the abstract classes provided by the JDBC API. The driver is used to connect to the database.

Q3. Name the different types of JDBC drivers?
Following are the different types of different:
a)Network protocol Driver
b)JDBC Net pure Java Driver
c)Native API Partly Java Driver
d)JDBC-ODBC Bridge Driver

Q4. Which JDBC driver is fastest?
The JDBC Net pure Java driver is the fastest driver.It converts the JDBC calls into vendor specific calls and thus it directly interacts with the database and eventually it is fastest.

Q5. Name the main components of JDBC ?
The main components of JDBC consists of the following phases:
a)DriverManager: Manages a list of database drivers. Matches connection requests from the java application with the proper database driver using communication subprotocol. The first driver that recognizes a certain subprotocol under JDBC will be used to establish a database Connection.
b)Driver: The database communications link, handling all communication with the database. Normally, once the driver is loaded, the developer need not call it explicitly.
c)Connection : Interface with all methods for contacting a database.The connection object represents communication context, i.e., all communication with database is through connection object only.
d)Statement : Encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed.
e)ResultSet: The ResultSet represents set of rows retrieved due to query execution.

Q6. What is resultset ?
The ResultSet represents set of rows retrieved due to query execution. ResultSet rs = stmt.executeQuery(sqlQuery);

Q7. What is rowset?
A RowSet is an object that encapsulates a set of rows from either Java Database Connectivity (JDBC) result sets or tabular data sources like a file or spreadsheet. RowSets support component-based development models like JavaBeans, with a standard set of properties and an event notification mechanism.

Q8. What are the different types of RowSet ?
There are two types of RowSet are there. They are:
a)Connected - A connected RowSet object connects to the database once and remains connected until the application terminates.
b)Disconnected - A disconnected RowSet object connects to the database, executes a query to retrieve the data from the database and then closes the connection. A program may change the data in a disconnected RowSet while it is disconnected. Modified data can be updated in the database after a disconnected RowSet reestablishes the connection with the database

Q9. What is connection pooling? what is the main advantage of using connection pooling?
A connection pool is a mechanism to reuse connections created. Connection pooling can increase performance dramatically by reusing connections rather than creating a new physical connection each time a connection is requested.

Q10. What is a database URL?
A database URL (or JDBC URL) is a platform independent way of adressing a database. A database/JDBC URL is of the form jdbc:[subprotocol]:[node]/[databaseName] If you are accessing a database called wham on the server using the xyz subprotocol, your database URL could be:

For more advanced and tough JDBC Interview Questions Click Here Copyright © 2009-2011 | All Rights Reserved
All content of this website is protected by copyright laws and should not be reproduced in any form or by any means without written permission
(Best viewed in IE 8.0+ or Firefox 3.0+ at resolution of 1024 * 768 or higher)