This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JDBC and the fly likes Registering driver with DriverManager Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Registering driver with DriverManager" Watch "Registering driver with DriverManager" New topic
Author

Registering driver with DriverManager

MaheshS Kumbhar
Ranch Hand

Joined: Sep 24, 2009
Posts: 188
Driver classes register themselves with DriverManager using static section at the time of loading driver class. My question is who loads the driver class so as to register with DriverManager?


I am slow but sure
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

MaheshS Kumbhar wrote:My question is who loads the driver class so as to register with DriverManager?

I think, we load the Driver class. In any "Hello World" JDBC program, you can find the first line like


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2497
    
    8

True for stand alone Java programs. If you are using containers to run your application (say: TomCat, Glassfish, what thave you), they load the drivers for all registered JDBC Connections.



OCUP UML fundamental and ITIL foundation
youtube channel
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Registering driver with DriverManager