Thursday, 8 October 2009

Quick unix command to determine JDBC driver version

Thought this was alot easier then extracting the actual JDBC JAR file and viewing META-INF/MANIFEST.MF. Of course you can still use the JDBC API via DatabaseMetaData, but normally you don't need to go to that effort.

UNIX

> unzip -p ojdbc14.jar META-INF/MANIFEST.MF | grep -C 1 version

WINDOWS

> unzip -p ojdbc14.jar META-INF/MANIFEST.MF

Note: If you have grep.exe for windows you could use this.

> unzip -p ojdbc14.jar META-INF/MANIFEST.MF | grep -C version

Output (Unix demo)
------------------------

[oracle@beast lib]$ unzip -p ojdbc14.jar META-INF/MANIFEST.MF | grep -C 1 version
Manifest-Version: 1.0
Implementation-Version: "Oracle JDBC Driver version - 10.1.0.5.0"
Specification-Title: "Oracle JDBC driver classes for use with JDK1.4"
Specification-Version: "Oracle JDBC Driver version - 10.1.0.5.0"
Implementation-Title: "ojdbc14.jar"

If your using 11g JDBC driver then you can do it as follows.

http://theblasfrompas.blogspot.com/2007/09/fast-way-to-determine-exact-11g-jdbc.html