• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

How we know which JDBC version we are using

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How we know which JDBC version we are using?

Thanks

Pankaj Shinde
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not very sure about this.

It depends on the database. For DB2, db2java.zip is for Type 2 and db2jcc.jar is for Type 4. You can read about the product documentation and the name of the jar/zip file you use for the JDBC Driver.

I don't think there is something like Manifest.mf file as that of jar file, with which you can find out the version of JDBC driver.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can (sort of) infer the JDBC version from the JRE version.
  • 1.0 and 1.1 -> JDBC 1
  • 1.2 and 1.3 -> JDBC 2
  • 1.4 and 5 -> JDBC 3
  • 6 -> JDBC 4
  •  
    Raghavan Muthu
    Ranch Hand
    Posts: 3389
    Mac MySQL Database Tomcat Server
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Ulf, this gives a different direction

    I thought the OP asked about how to deduce from the jdbc jar file! But do you mean to say that the versions did NOT support the other types?
     
    Sheriff
    Posts: 9109
    12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    We are using using JRE 1.4. Some of the code (written mostly under JDK 1.2/1.3) works only with the (db2java.zip) Type 2 driver, some of it works only with the (db2jcc.jar) Type 4 driver, and some of the java code works with both.
     
    Raghavan Muthu
    Ranch Hand
    Posts: 3389
    Mac MySQL Database Tomcat Server
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thank You Marilyn de Queiroz.

    Now i really doubt what was the intention of Original Poster! Was it with respect to the JDBC Driver or the JRE version?

    Also, is it true that the particular JRE version does support ONLY a certain type of JDBC drivers? I never had a thought on this!
     
    author & internet detective
    Posts: 42163
    937
    Eclipse IDE VI Editor Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Raghavan Muthu:
    Now i really doubt what was the intention of Original Poster! Was it with respect to the JDBC Driver or the JRE version?


    When we talk about the JDBC Driver, there are two numbers associated with it. There is the type (type 1, 2, 3 or 4) and version of the JDBC spec supported (JDBC 3, JDBC 4, etc)


    Also, is it true that the particular JRE version does support ONLY a certain type of JDBC drivers? I never had a thought on this!


    No, multiple JRE versions can work with the same driver. My comment applies to both the type of the driver and the version of the spec. There are some dependencies between JRE versions and versions of the JDBC spec, but it's not always one to one.
     
    Ranch Hand
    Posts: 544
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hello,
    This can be done using two methods in Driver interface.
    - java.sql.Driver.getMajorVersion() j
    - java.sql.Driver.getMinorVersion().

    Please correct me if I am wrong.

    Regards,
    Amit
     
    Raghavan Muthu
    Ranch Hand
    Posts: 3389
    Mac MySQL Database Tomcat Server
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Jeanne Boyarsky:

    When we talk about the JDBC Driver, there are two numbers associated with it. There is the type (type 1, 2, 3 or 4) and version of the JDBC spec supported (JDBC 3, JDBC 4, etc).



    That is another point to be noted and added Thank you Jeanne!

    I am aware of the JDBC spec version and also some versions of JDBC are implemented in the JRE versions.

    I guess Ulf also told the same. Now only it did strike me
    [ January 19, 2008: Message edited by: Raghavan Muthu ]
     
    Raghavan Muthu
    Ranch Hand
    Posts: 3389
    Mac MySQL Database Tomcat Server
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Jeanne Boyarsky:

    No, multiple JRE versions can work with the same driver. My comment applies to both the type of the driver and the version of the spec. There are some dependencies between JRE versions and versions of the JDBC spec, but it's not always one to one.



    Yes, thats very true Jeanne. But what Marilyn told also of the same with the the type of jdbc driver (1,2,3,4) with the JRE and NOT with the spec! That's why i asked such a question.

    Now i think the the Original Poster might have asked the JDBC Spec version and NOT the jdbc driver type version! , by looking at the way you and Ulf replied!
     
    Raghavan Muthu
    Ranch Hand
    Posts: 3389
    Mac MySQL Database Tomcat Server
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by amit punekar:
    Hello,
    This can be done using two methods in Driver interface.
    - java.sql.Driver.getMajorVersion() j
    - java.sql.Driver.getMinorVersion().



    Yes amit. You can get the JDBC Spec version being supported through these methods!
     
    Ulf Dittmer
    Rancher
    Posts: 43081
    77
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Raghavan Muthu:
    Now i think the the Original Poster might have asked the JDBC Spec version and NOT the jdbc driver type version!


    There is no such thing as a "driver type version". We don't know what the OP was asking about, but there are 3 numbers to keep apart: the JDBC version in use (which I outlined above), the JDBC driver version (which Amit talked about), and the driver type.

    For compatibility it's important that the JDBC version is larger or equal to the JDBC driver version. In other words, the JRE must support a JDBC version that is at least as new as the version supported by the driver.
     
    Raghavan Muthu
    Ranch Hand
    Posts: 3389
    Mac MySQL Database Tomcat Server
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    That's very true Ulf. I also got and told the same about OP's intention.

    Thank you
     
    Ranch Hand
    Posts: 126
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    If you are looking at the file from which the driver is loaded take a look at this site

    Finding from where the java class is loaded
    http://javaonthefly.blogspot.com/2008/01/finding-from-where-java-class-is-loaded.html

    Thanks
    Raees
     
    Pankaja Shinde
    Ranch Hand
    Posts: 87
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Just I want to know which JDBC API I am using. Is it 1.0 or 2.0 or 3.0 or 4.0. As I am getting problems for the code that uses JDBC API 2.0, i.e. code using Scrollable ResultSet(Following link shows my post that encounters this problem, heading com.mysql.jdbc.NotUpdatable ...).

    https://coderanch.com/t/306460/JDBC/java/com-mysql-jdbc-NotUpdatable-Result

    That's why I want to confirm that am I using JDBC API 2.0 or not. I got correct results for code that uses JDBC API 1.0. Actually problem is in my code (I forgot to set primary key).

    I really thanks to all of you. Specifically Ulf Dittmer and Raghavan Muthu for such a valuable discussion.

    Thanks
    Pankaj Shinde
    SCJP
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic