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.
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
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
Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Joined: Feb 26, 2005
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.
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
Joined: Feb 26, 2005
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
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!