| Author |
what if I regiter more than one driver?
|
kumar jha
Greenhorn
Joined: Jan 31, 2009
Posts: 3
|
|
We can register more than drvers using Class.forName("stringDriver1"), Class.forName("stringDriver2") and Class.forName("stringDriver3").
So which driver is used when we try to get a connection object, say, DriverManager.getConnection() ?
|
 |
Sagar Rohankar
Ranch Hand
Joined: Feb 19, 2008
Posts: 2896
|
|
kumar jha wrote:We can register more than drvers using Class.forName("stringDriver1"), Class.forName("stringDriver2") and Class.forName("stringDriver3").
So which driver is used when we try to get a connection object, say, DriverManager.getConnection() ?
This explains itself. DriverManager#getConnection(String url)
And Welcome to JavaRanch
|
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
|
 |
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
Kumar ,
It lies with the DriverManager decision. It chooses the appropriate correct driver from the loaded drivers using the connection string.
Connection String usually contains the type of database it uses and DriverManger takes care of using the correct driver.
|
 |
 |
|
|
subject: what if I regiter more than one driver?
|
|
|