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 is setautocommit in jdbc?

491


What is jdbc connection interface?

522


What is jdbc driver for sql server?

538


How many rowset are available in jdbc?

667


What are the differences between stored procedure and functions?

478






What is JDBC Connection isolation levels?

549


Explain about the drive manager class working?

608


Does sql allow null values ?

549


What is jdbc and jdbc drivers?

506


What's the benefit for specifying constraints like not null, primary key explicitly instead of specifying it against the column ?

480


What is metadata in java programming?

493


What is metadata in programming?

530


What is metadata in jdbc?

489


How will you perform truncation using JDBC?

579


Does jdbctemplate use prepared statements?

513