How application creates a connection



Q) How can your application creates a connection?

Rep) Connection is an Interface. The JDBC Driver provides a class implementing java.sql.connection interface

When our application calls DriverManager.getConnection method it internally calls the ConnectMethod provide by the JDBC Driver Vender in the Driver class. The code of the Connect Method connects to the DBServer and Creates an object based on a class implementation the connection interfaces.

In order to register a driver with a driver manager.we can provide the code

Class.forName(oracle.jdbc,driver.OracleDriver());

//Takescare of regestring the Driver.

After executing of this code class is loaded in memory then the static block will be executed.static block consist of the code which can register the driver. It isthe responsibility of every JDBC vender to provide the static block

Random Posts

  • Date Format
  • Basic Java Interview Questions on lang package
  • Explain JSP Declaration
  • JAVA UTIL PACKAGE
  • Creating the Java Class

Post a Comment