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
Does the JDBC-ODBC Bridge work with Microsoft J++?
Does jpa use jdbc?
How does JDBC API helps us in achieving loose coupling between Java Program and JDBC Drivers API?
What is the JDBC?
How do java applications access the database using jdbc?
DB2 Universal claims to support JDBC 2.0, But I can only get JDBC 1.0 functionality. What can I do?
What is connection data?
What is jdbc template?
What is jdbc stand for?
Why do we use jdbc?
How can I determine where a given table is referenced via foreign keys?
What does the jdbc driver interface do?
What is the role of class.forname while loading drivers?
What are the differences between statement and preparedstatement interface?
What is the function of drivermanager class?