File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Class.forName()" Watch "Class.forName()" New topic


aakash bhatt
Ranch Hand

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

Rodney Cabahug

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

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:
subject: Class.forName()
It's not a secret anymore!