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

Why do we need jdbc driver?

626


What is jdbc driver in java?

651


Why do you use a data source object for a connection?

728


What are JDBC Best Practices?

763


How to check jdbc connection in java?

660






What are the main steps in java to make JDBC connectivity?

765


When do we use execute method in java jdbc?

691


What is SQL Warning? How to retrieve SQL warnings in the JDBC program?

710


Which interface handles transaction management in jdbc?

775


What does the jdbc resultset interface?

708


What are different types of JDBC Drivers?

687


What is transaction processing in jdbc?

724


What is xe in oracle jdbc url?

720


How to retrieve warnings in jdbc?

695


What is jdbc odbc bridge in java?

736