what exactly happens when we execute
"Class.forname("Driver class name");"?Explain indetail

Answer Posted / srinivas.r, -parigi

Class is predefined class and .forName() is the static
method , it is responsiblity of jdbc Driver implementer to
provide a static block as part of the driver class.As part
of this sttic block code will be provided to take care of
registering the driver
EX : --------------****--------
public class Drv implements Driver
{
static{Driver d=new OracleDriver();
DriverManager.register(driver);
}}
----------------*******--------
As the sttic block provided by the driver vender can take
care of registering the driver instance of following code
----------
Driver drv=new Oralce.jdbc.driver.OracleDriver();
DriverManager.registerDriver(driver);
----------
by providing directly
Class.forName("oralce.jdbc.driver.OracleDriver");
the above code will be executed.........All the best.
------- Thank u to providing this facility

Is This Answer Correct ?    12 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the factors that the jdbc driver performance depends upon?

503


What is JDBC PreparedStatement?

516


What is createstatement method in java?

486


What are the utilities of the callablestatement?

500


What is the different between ResultSet and RowSet?

521






What are the ddl statements?

454


Explain the various types of locking system in jdbc?

476


Does jdbctemplate use prepared statements?

489


Explain in detail about JDBC and its general features?

511


What are the new features available in jdbc 4.0?

514


Give steps to connect to the db using jdbc?

565


How can I use the JDBC API to access a desktop database like Microsoft Access over the network?

513


What are the jdbc drivers in java?

503


What are jdbc?

528


Define preparedstatement.

511