Artikel Terbaru

Sunday, 4 December 2011

Top 10 JDBC Interview Questions

1.what are different frequent JDBC classes or interfaces used in java code?

Connection,DriverManager,ResultSet,Statement,PreparedStatement,CallableStatement.

. 2.How do you load the JDBC driver class?.

Class.forName("DriverClass") is used load the driver class. whenever DriverClass is loaded with this, create a new instance of DriverClass and register the driver with DriverManager Class.Once Driver is registered, it is ready to create physical connections to database using Connection object.

3.What is connection pooling?.

as a creating a database connection is like a opening a socket connection to remote machine, so this call is expensive. whenever we have to do CRUD operations(create,read,update and delte) on data to database,Connection object is used for this. creating a connection for each operation is expensive. To avoid this, at the Initial state(application startup), creating a pool of connections which are created and connected to the database. whenever an database operation is to needed by application, the connection from pool of connections are reused,once the operation is over, the connection is returned instead of closing(in case of normal connection) connection, so that Database calls are reduced and nonperformance is increased.