File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 Spring in Action this week in the Spring 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: 2503
    
    8

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: 5836
    
    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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: After loading many drivers how to use specific?