• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A doubt in JDBC

 
barbie amr
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a doubt in JDBC.
Suppose i load more than 1 driver in the connection say
Class.forName("sun.jdbc.odbc.jdbcodbcDriver");
Class.forName("some other dirver)
and if i say
Connection con = DriverManager.getConnection(the driver)
Which driver will the application take, is it the one specified in the connection object. If so what will happen to other drivers.
Do let me know at the earliest

thanks and regards
barbie

 
Senthil B Kumar
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although there is typically only one driver registered in each application, you can load multiple drivers in one application. Load each driver using the same methods as above. The DriverManager decides which driver to use when connecting to the database
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Barbie,
The connection URL also serves as a hint to which driver should be used.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic