aspose file tools*
The moose likes JDBC and the fly likes Confusion with type 1 driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Confusion with type 1 driver" Watch "Confusion with type 1 driver" New topic
Author

Confusion with type 1 driver

rakesh kadulkar
Ranch Hand

Joined: Jul 24, 2008
Posts: 115
Hi,

I have a doubt regarding JDBC-ODBC bridge driver.

Upto what I know in type1 driver you make a call to jdbc api. This call gets translated to odbc call and then database specific native call.

What i am not able to undesrtand :

step 1 :- Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //will load the driver.
step2:- DriverManager.getConnection("jdbcdbc:dsn");//This statement will internally calls the connect method of driver that is on the JdbcOdbcDriver class.

Step2 will rerurn me the connection object that means the object of the class that is providing implementation to the Connection interface.
My question is who will provide this class with the type1 driver.

Thanks



Rakesh Kadulkar
rakesh kadulkar
Ranch Hand

Joined: Jul 24, 2008
Posts: 115
further i want to ask where can i find this package

sun.jdbc.odbc in my jdk installation
Vinnibabu singu
Ranch Hand

Joined: Aug 19, 2009
Posts: 30
sun.jdbc.odbc.JdbcOdbcDrive


jdk will just have the interfaces of the driver classes .The actual implemented classes will be provided by the database vender .
These classes will be loaded into your system on installation of the databases ex: oracle into your system only.You can find these classes in the drivers folder some where in your oracle folder .
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874



jdk will just have the interfaces of the driver classes .The actual implemented classes will be provided by the database vender .


thats true, "sun.jdbc.odbc.JdbcOdbcDriver" comes with JDK & JRE.
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3697
    
    5

There seems to be a done of questions about drivers lately, so let me see if I can sum it up "The maker of the database software provides the JDBC driver 99.99% of the time". The only exception is if there is no JDBC driver for that database, in which case an open source project may contain it, although this is rare in practice.

It makes sense if you think about it. JDBC is a universal method for you to write code that works on any database (in theory anyway), whereas the driver is the module that actually connects your JDBC code to the database, therefore the driver will be different for every database since interacting with each system is different. It also makes sense that it should not be included as part of the standard JVM. Could you imagine how many different database systems, versions of the system, and versions of the drivers Sun would need to include? The confusing part for most people seems to be "Yes, you need to go download a driver specific to your database" and "Yes, such a driver does exist. In fact it's often installed on your harddrive with the database itself".


My Blog: Down Home Country Coding with Scott Selikoff
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Confusion with type 1 driver
 
Similar Threads
What is ODBC
regarding JDBC-ODBC Bridge Driver
JDBC/ODBC classnot found exception
Not connecting to database through log4j
regarding JDBC ODBC bridge(native client code)