Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confusion with type 1 driver

 
rakesh kadulkar
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
further i want to ask where can i find this package

sun.jdbc.odbc in my jdk installation
 
Vinnibabu singu
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
author
Saloon Keeper
Posts: 4008
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic