This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JDBC and the fly likes Clarification regarding Drivers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Clarification regarding Drivers" Watch "Clarification regarding Drivers" New topic
Author

Clarification regarding Drivers

rajaraman navaneethan
Ranch Hand

Joined: Feb 26, 2005
Posts: 86
Dear friends,
i am a novice in JDBC, and i have just started to explore it in detail.i understand that there are 4 types of JDBC drivers like Type1,2,3,4 and other database drivers like ODBC.from various material available i understand that Driver is an interface which is used as a middleman between the Java Program and the Database.
it is being told that the implementations for Drivers are provided by respective vendors.i dont understand whom do they refer by vendors.I guess that the implementations for JDBC drivers Type1,2,3,4 is given by Sun and for drivers like ODBC is given by respective database vendors.
Do the implementations for interfaces like Statement,PreparedStatement,etc are also provied by Sun?
kindly clarify my doubts
thanx & regards
Raja
Sunil Dumpala
Greenhorn

Joined: Jul 28, 2005
Posts: 29
Rajaraman,

Drivers 1,2,3,4 are more generic way to define a driver. Any given driver has to be one of the 1,2,3,4 type Driver (even the ODBC driver).

Yes, Sun provides tutorials for using PreparedStatememnt, CallableStatement etc.,
For example the following link is tutorial for using PreparedStatement

http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html

Thanks,
Sunil Dumpala
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

Originally posted by rajaraman navaneethan:
I dont understand whom do they refer by vendors.


vendor means driver provider, more the times It driver provider is same as database provider and referred commonly as vendor.

As a example if you are using classes12.zip to connect oracle then in
this case DB provider is Oracle and since classes12.zip is given by Oracle so driver provider is also Oracle.

Similarly implementions of other interfaces like PreparedStatement,Statement and other interface are also given by driver provider

for exaplme if you are using sql server and using driver provided by MicroSoft then your both DB provider and driver Provider would be same but you can also use jTDS to connect with SQL Server in this case you Driver provider would change,It would be now jTDS and implemntation of all interface would be given by jTDS driver

Hope this clears you confusions

Shailesh
[ September 16, 2005: Message edited by: Shailesh Chandra ]

Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
rajaraman navaneethan
Ranch Hand

Joined: Feb 26, 2005
Posts: 86
hi Shailesh,Sunil,
thanx for your quick replies.
Shailesh, i am using JDBC-ODBC bridge driver, to connect to MS Access database.i write simple jdbc programs using Statement and Prepared Statement.so the implementations for these are provided by MSAccess itself.
Shailesh please confirm if my understanding is correct.

regards
Raja
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41635
    
  55
The JDBC-ODBC bridge is an exception - it is part of the JDK itself. Most other drivers are provided by the database vendors, though, except for commercial third-party ones.


Ping & DNS - my free Android networking tools app
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

I agree with Ulf Dittmer !!!

rajaraman If you look back at your code you might be registering your driver like


here you are using JdbcOdbcDriver to establish a connection means your driver provider is sun and sun offers this driver as a part of JDK, eventually same thing what Ulf Dittmer said.

hope this clear your understanding

Shailesh
rajaraman navaneethan
Ranch Hand

Joined: Feb 26, 2005
Posts: 86
hi sailesh,
thanx for the replies.i understand that type-1 driver implementation is given by Sun.can u please give me examples for loading any other drivers like type-2,3,4 whose implementations are provided by the database vendors?
regards
Raja
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

The following assumes that 'thanx' means 'thanks' and 'u' means 'you. We try to prevent misunderstanding by using real words.

can u please give me examples for loading any other drivers like type-2,3,4 whose implementations are provided by the database vendors?

Loading a Type-1 Driver:

Loading a Type-2 Driver:

Loading a Type-3 Driver:

Loading a Type-4 Driver:


I'm not teasing you here, this is one of the strengths of JDBC: changing Driver types or even vendors is often just a matter of changing the loaded Driver and JDBC URL! If written carefully you may not need to rewrite a single line of code!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Clarification regarding Drivers