If 4 different drivers are loaded, & created 4 different statements calling diffener tables from same database, how driver is recognized for each statement?

Showing Answers 1 - 4 of 4 Answers

sudhir kumar

  • Oct 20th, 2005
 

I want the answer of this quetion

  Was this answer useful?  Yes

kecai

  • Oct 26th, 2005
 

1. JDBC connects to DB through Driver

2. When we use a Driver, we need to do 3 things:

  a) Load driver class;

  b) Create instance of it;

  c) Register it into DriverManager.

  But in real life, it's very luck that we can realize these in ONE step:

  Class.forName("Your.Driver.Class");

3. Then we can use conn=DriverManager.getConnection("DB.URL")

  to get "connection" belong to the Driver.

4. Next, Statement = conn.createStatement(SQLofTableX);

SO, diff. driver has diff. conn; diff. conn has diff. statement; diff. SQL for diff. table. Every thing is unique.

kecai

  • Oct 26th, 2005
 

AND, The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions