Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jdbc and Driver Manager

 
Kevin Fonner
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was reading that the java.sql.DriverManager provides basic services for managing JDBC drivers. However, I can also choose not to register the driver with the DriverManager and just make a direct connection.
What am I looking at here and how do I choose whether or not to use the Driver Manager.
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I always use the DriverManager, but maybe that's because I didn't learn the other way of diong it.
Mark
 
uma sakthi
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is always good to register the drivers with the driver manager. This is a factory pattern. Good programming practice to always access the implementation( that is the driver) through a factory( that is the driver manager) . This results is low coupling
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic