Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
loading the JDBC driver
02-05-2008, 10:16 PM
Post: #1
loading the JDBC driver
What is the difference between Class.forName("driverClass") and

DriverManager.registerDriver(new DriverClass());
?
Find all posts by this user
Quote this message in a reply
02-05-2008, 10:22 PM
Post: #2
RE: loading the JDBC driver
When we use the Class.forName the static block inside the driver would call the registerDriver method of DriverManager class and register itself.

When we use the DriverManager.registerDriver, the static block of the driver class would again executed and register the driver. But here the registerDriver would be invoked twice one from static block and one by explicit call of registerDriver method
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: