This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 2491
    
    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: 5812
    
    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?
 
Similar Threads
Loading file data into a DB2 table using java
Connecting with SQL 2000
How to connect to MS ACCESS through our own Driver
Tomcat not loading mysql database driver
Connection through DSN