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.
Joined: Jun 03, 2011
Thank you philip
Joined: Oct 24, 2005
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)