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

What does module-relative mean?

573


What is chat area? Explain.

553


When a thread blocks on i/o, what state does it enter?

571


Why is string immutable in java?

577


Explain ioc concept?

621






What is threadfactory?

612


What is in-memory replication?

556


Do I need to import javlang package any time? Why ?

625


What is prototype?

606


What value does read() return when it has reached the end of a file?

549


Write a singleton program?

566


Why doesn’t the focus feature on the tag work in every circumstance?

561


Which containers use a border layout as their default layout?

606


wahts is mean by dynavalidatorform in struts/

1567


What must a class do to implement an interface?

583