This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JDBC and the fly likes Class.forName() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Class.forName()" Watch "Class.forName()" New topic
Author

Class.forName()

aakash bhatt
Ranch Hand

Joined: Jan 09, 2003
Posts: 182
What is the significance of the code Class.forName() while doing a connection?

Thanks,
aakash
Rodney Cabahug
Greenhorn

Joined: Sep 01, 2004
Posts: 1
The Class.forName() will try to load the class that you specified as string argument. If the class that you specified cannot be found in the classpath, Class.forName() will throw a ClassNotFoundException.


[ ロドニー。カバフグ ]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
I'm thinking that you're curious about the significance of this code in the context of JDBC. So, I'm moving this to the JDBC forum...


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
It registers the JDBC driver. Check the API docs for java.sql.Driver and/or java.sql.DriverManager for more info.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Class.forName()