• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Clarifications required for JDBC Drivers

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am going through the JDBC topics and have following dobuts in my mind. Please clarify these doubts. Thanks in advance.


1. Who writes the drivers for JDBC? I think it is the DB Vendor who writes the JDBC drivers like oracle, mysql, db2 etc. Please confirm if this understanding is correct.

2. Do the Databases support only one type of JDBC driver like Type1/Type2/Type3/Type4? Or, do they support all kinds of drivers and we can chose which driver to choose?

3. Can we check using some Java code, what is the type of Driver we are using?
 
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can answer 2 of your questions
1, I don't know, I just know it isn't me so I am happy.
2, there can be many type drivers for each db i think if you want you can use ODBC (type 3?) on most database if you don't have a type 4 driver.
3, no idea, but why do you care?
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll try to take on this too:

1) Whoever feels like it. Usually it is the DB vendor, but there certainly are some open source JDBC drivers available. For example, the jTDS driver once was (and perhaps still is) more popular than the Microsoft's own driver for conncting to the SQL Server.

2) The database generally cannot distinguish driver types (unless this information is part of the protocol the driver uses to talk to the database). As there is usually a network connection between the DB and the JDBC driver, the database just sees a stream of data - adhering to some network protocol - created and sent by the driver over the network. It is generally impossible to deduce, just from this stream of data, who is at the other end of the connection.

(The ODBC bridge is actually Type 1 driver. Driver types are described on the Wikipedia, for example. Not that the type numbers would be that important - everyone says "ODBC driver" instead of "type 1 driver".)

3) The JDBC specification does not include a way of getting this information, so in general - no. You might want to be able to distinguish this if various types of drivers supported different feature sets. This is partially true for Oracle drivers, for example: an OCI driver ("type 2") supports a few advanced (and rarely used) features the thin driver does not. I believe it is possible to tell these drivers apart somehow, but in any case it would be Oracle specific feature of the driver.
 
Vaibhav G Garg
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks everyone for your inputs.
reply
    Bookmark Topic Watch Topic
  • New Topic