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
Name the types of jdbc drivers.
What is a java driver?
How do you determine the sensitivity of the ResultSet object?
Can I use JDBC to execute non-standard features that my DBMS provides?
What is jdbc odbc connection?
How to check jdbc driver version in websphere?
Is it possible to connect to multiple databases simultaneously?
How does a custom RowSetReader get called from a CachedRowSet?
What causes the "No suitable driver" error?
What is savepoint in jdbc?
What are the advantages of using jdbc datasource?
What do you mean by jdbc batch processing and what are the advantages of using jdbc batch processing?
code to insert values/rows into oracle database from a java swing textfield when a button is pressed(using preparedstatements)
Explain about the Try Block?
Give a way to check that all result sets have bin accessed and update counts are generated by execute method.