This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes load and register driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "load and register driver" Watch "load and register driver" New topic
Author

load and register driver

priyanaka jaiswal
Ranch Hand

Joined: Jun 03, 2011
Posts: 79
Hi All,

why we load and Register the driver in Jdbc?
Philip Grove
Ranch Hand

Joined: Aug 18, 2009
Posts: 68

priyanaka jaiswal wrote:Hi All,

why we load and Register the driver in Jdbc?


I am not sure I understand you correctly, but the JDBC does not know of specific databases so you need to add that information somehow.
priyanaka jaiswal
Ranch Hand

Joined: Jun 03, 2011
Posts: 79
Thank you philip
Ashutosh Limaye
Ranch Hand

Joined: Oct 24, 2005
Posts: 58
priyanaka jaiswal wrote:Hi All,

why we load and Register the driver in Jdbc?


The JDBC driver is the implementation of the JDBC specification. A type four JDBC driver in particular is normally provided to us by the database vendor.
Now in order to get connected to that DB we require to load the driver in the heap. Since the location of only the library classes is known in advance, you have to provide the location for your driver by setting the classpath to point to the driver's jar file and at the same time using fully qualified name in the Class.forName() method.
More over your program might be bringing data from various databases in which case you might require two or more drivers at the same time. To have an ordered access to the drivers JDBC provides us with the DriverManager . Usually every Driver has to register itself with the DriverManager. The registration code could be written inside a static block in the Driver class, hence Class.forName(), a single line does both loading and registration of the driver.(static blocks are executed during load time)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: load and register driver
 
Similar Threads
connect oracle type 4 driver in eclipse
loading JDBC driver twice
Can not find driver?
jdbc with microsoft SQl Server 2008
diff b/w class.forName() & DriverManager.registerDriver