What is the use of Class.forName

Answer Posted / raghavendra desai

when the Class.forName("oracle.jdbc.driver.OracleDriver) is
executed, the driver calss will be loaded if it was not
loaded earlier. As soon as the class is loaded the static
block will be executed. In the static block the JDBC driver
vendors are responsible for providing the static block in
the driver class. In static block they would have been
written the similar kind of code.

public class oracle.jdbc.driver.OracleDriver implements
Driver
{
static
{
Driver drv= new oracle.jdbc.driver.OracleDriver();
DriverManager.registerDriver(drv)
-----
-----
some other code

}
}

Is This Answer Correct ?    36 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

the same information whether it will connect to the database or it will be used previous information?

782


Explain what is synchronization?

813


In our urls and in the text of the buttons we have comma. Its causing an error. Is there a way to change the delimiting character for the menu arguments?

824


What are the services in RMI ?

2072


Write a singleton program?

770






Java is fully object oriented languages or not?

730


What class is the top of the awt event hierarchy?

805


How primary key is implemented in Oracle?

2128


What are the pros and cons of detached objects?

736


Which characters may be used as the second character of an identifier, but not as the first character of an identifier?

753


Write a program to show synchronization?

858


What restrictions are placed on the values of each case of a switch statement?

726


Is it possible to stop the execution of a method before completion in a sessionbean?

806


whats is statement and procedure

1789


Difference between loadclass and class.forname?

786