This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Registering driver with DriverManager

 
MaheshS Kumbhar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jan Cumps
Bartender
Posts: 2596
12
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic