aspose file tools*
The moose likes JDBC and the fly likes After loading many drivers how to use specific? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "After loading many drivers how to use specific?" Watch "After loading many drivers how to use specific?" New topic
Author

After loading many drivers how to use specific?

Umesh Vajpai
Greenhorn

Joined: Mar 14, 2010
Posts: 26
Hi,
consider case-

Class.forname(Driver_1);
Class.forname(Driver_2);
Class.forname(Driver_3);

Connection con = DriverManager.getConnection(...);

Could any one tell me when i will be using con with statement then which connection will be used?
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2516
    
  10

Your driver knows that. The first driver that recognizes your connection string will do the job.


OCUP UML fundamental and ITIL foundation
youtube channel
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

With the number of Ranchers who have asked this same question in the past week I am beginning to suspect that this is a school assignment.
http://www.coderanch.com/t/487913/JDBC/java/calling-classforname-twice
http://www.coderanch.com/t/487022/JDBC/java/Which-Driver-will-used


JBoss In Action
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: After loading many drivers how to use specific?