File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Why 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 "Why Class.forName?" Watch "Why Class.forName?" New topic
Author

Why Class.forName?

Pavan Sambare
Greenhorn

Joined: Aug 21, 2006
Posts: 23
When you load a JDBC driver you use Class.forName to load it. Any reasons why?
What I thought is that you can pass an externalized string to Class.forName and thus use any Driver at runtime.
Does it also have to do something with ClassLoader hierarchy?


SCJP 1.4 -- 98%<br />SCWCD 5 -- 97%
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Have a search through this forum. THis question gets asked a lot, so there will be loads of answers. Als ohave a read through our JDBCFaqs, these cover a lot of the basics of JDBC.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
 
subject: Why Class.forName?