Why do we need to use Class.forName() to load a JDBC driver into the memory? Is there any other method? Can we use new operator to instantiate the Driver class.
gokul krishna
Greenhorn
Joined: Jul 01, 2003
Posts: 2
posted
0
Hi amit, Actually class.forName is the JDBC API in which u can register ur driver in the memory to connect into the Database. Even u can register more than one driver also. Apart from this, u can also register using the oracle driver using the DriverManager class. DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); By doing the above also u can register your driver.
You can also define a "system" property (using the '-D' command-line option), but I forget the name of it. I think it is "jdbc.driver". In any case, you can find details in the Getting Started Guide. Good Luck, Avi.
David Gallardo
Author
Greenhorn
Joined: Jul 07, 2003
Posts: 18
posted
0
Yes, you can instantiate the driver and register it as follows: DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Yet another way is to use the DataSource API. @D [ August 02, 2003: Message edited by: David Gallardo ]
Co-author: "Eclipse in Action: A guide for the Java developer"<br />Author: "Java Oracle Database Development"
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.