Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

oracle jdbc driver version madness

Why the heck does Oracle offer a different(!) version of the JDBC driver, e.g. ojdbc14.jar, for every(!) database version?
The files all have different sizes and thus probably different content.

background:
We get a random and seemingly irreproducible error saying "invalid number" when saving data (we guess it's the Timestamp). But it's not any particular statement. Most of the time, it saves just fine. Just once a month a harmless looking statement will fail.

So i had a closer look at Oracle's download site and noticed that none of the filesizes match despite files sharing the same name.

Our product is run on databases maintained by our clients, i.e. whatever version and patch the clients have running is what it is.
So what driver do we use? The latest (Oracle 11g) - despite the fact that it's usually 9i and 10g databases?

Why don't they just link all versions to the same "one driver suits all" file?
Or are there minute differences leading to effects like our random errors?

EDIT: i was mistaken about the 9i databases.

like image 552
Stroboskop Avatar asked Apr 16 '09 13:04

Stroboskop


2 Answers

please see the compatibility matrix at http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#02_02

Also take in mind that the timestamp datatype is only available since Oracle 10.

like image 147
Oliver Michels Avatar answered Sep 20 '22 17:09

Oliver Michels


The numbers in ojdbc14.jar, ojdbc5.jar, ojdbc6.jar, ojdbc7.jar and ojdbc8.jar refer to the version of the Java compiler that was used. With every version of Java come new JDBC APIs so these numbers are useful to know what to expect. For example in Java 8, there is a new method executeLargeUpdate in java.sql.PreparedStatement. This method will be implemented in ojdbc8.jar but not in ojdbc7.jar. Also if your runtime uses Java 7 then you know you can't use ojdbc8.jar otherwise you'll run into a java.lang.UnsupportedClassVersionError error. These are the reasons why Oracle includes these numbers in the jar's name. Also note that if you want to know from which Oracle Database release the jar comes from you can run java -jar ojdbc8.jar. Both the Database and the driver are backward compatible (up to 1 major release) so, even though it's recommended, you don't have to use the same version of the product on both tiers.

like image 42
Jean de Lavarene Avatar answered Sep 18 '22 17:09

Jean de Lavarene