Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization 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: 2906
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: 2584
11
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.


 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic