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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Registering driver with DriverManager" Watch "Registering driver with DriverManager" New topic

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

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

Joined: Dec 20, 2006
Posts: 2491

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
I agree. Here's the link: http://aspose.com/file-tools
subject: Registering driver with DriverManager
Similar Threads
loading JDBC driver twice
jdbc with microsoft SQl Server 2008
reg class.forName()
diff b/w class.forName() & DriverManager.registerDriver