OJDBC Driver compatible with Oracle 10g and Java 1.8 - java

I am having a rather trivial question. In our project we are using Oracle 10g as the database and Java 1.8 as the language. Can anyone please suggest me which JDBC driver will be suitable in this case?
In the Oracle documentation in the below link:
http://www.oracle.com/technetwork/apps-tech/jdbc-10201-088211.html
I found that ojdbc14.jar should be used. However it is written that it is classes compiled using JDK 1.4 and 1.5. So should I use the same driver when using JDK 1.8?

You can try using ojdbc14.jar however it won't support methods introduced in JDBC 4 (Java 6), JDBC 4.1 (Java 7) and JDBC 4.2 (Java 8). Because Java emphasizes backwards compatibility you most likely will be able to open the database connection, however:
The code will throw LinkageError in runtime if you use methods introduced in JDBC 4+. The code will compile with JDBC 4.2 (Java 8) but these methods will not be available during runtime.
You may experience weird behavior with low level features e.g. statement caching and row fetching was modified in 11g ojdbc6.jar few times. I'm not even sure how this features work in the old ojdbc14.jar.
It's a very unusual, an I'd say not advisable, setup that you want to test. The only way to see if it works is to try it.

Related

Hibernate support for JDBC specification 4.3?

In the docs for Hibernate ORM 5.4 it states that the System Requirements require at least Java 1.8 and JDBC 4.2.
The same can be found for the docs for version 6.0.
Hibernate 5.2 and later versions require at least Java 1.8 and JDBC 4.2.
So is the JDBC 4.3 specification (proposed changes) supported by Hibernate ORM 5.4? Does it matter? I assume that any unsupported method call will just throw a SQLFeatureNotSupportedException.
I just can't find anything that explicitly states that JDBC 4.3 is or is not supported and need that cleared up.
Any JDBC 4.3 driver will also be compliant with JDBC 4.2 (as the JDBC 4.3 specification includes everything from JDBC 4.2). So, if a library requires at least JDBC 4.2, then it will also work with a JDBC 4.3 driver.
This does assume - of course - that the library itself is able to run on Java 9 (which introduced JDBC 4.3) or higher, but given Hibernate is tested on - at least - Java 8 and Java 11, that would be the case.
As far as I'm aware, Hibernate does not use any features introduced in JDBC 4.3.

Database version upgrade for java applications

We will have to update our databases version Oracle v11 to v19.
The database part itself doesn't matter for this discussion, because it will be made by our DBA's.
Besides having to upgrade the JDBC connectors' version and maybe changing how they are instantiated, what are the possible problems and refactors we might have to do?
The applications are in JAVA.

Oracle 19c compatibility with jdk7

I would like to know if oracle 19c is compatible with jdk 7.
I have found out 2 drivers for oracle 19c
ojdbc8 : for jdk8, jdk9 and jdk11
ojdbc10 : for jdk10 and jdk11
I would like to know if there is a way to have oracle 19c with a jdk7, and if yes what is the driver that will allow to do it ?
According to the Oracle JDBC FAQ (Question "What are the Oracle JDBC releases Vs JDK versions?"), only the Java versions you listed (Java 8 to 11) are supported for Oracle 19c.
I expect that support for later Java versions will be added in the future.
Java 9 and Java 10 were short-life releases, and are both end-of-life.
As a comment notes, Java 7 has been "end of life" since April 2015. It would be counter-productive for Oracle to encourage continued use of Java 7 by supporting it with new JDBC drivers for new Oracle database releases.
Note that the Oracle drivers are proprietary and source code is not available. So back-porting one of the Oracle 19c compatible drivers to Java 7 is not an option.
You may be able to identify a 3rd-party vendor who will provide (probably sell) you a driver that works. The best I could come up with is this old page that lists vendors:
https://www.mindprod.com/jgloss/jdbcvendors.html
In summary: If you want to use Oracle 19c with Oracle supported drivers, upgrading to Java 8 LTS or later is the only feasible solution. Upgrading to Java 11 LTS is advisable:
Oracle Java 8 LTS free public updates (for commercial users) have ended, and Premium Support is due to end in March 2022; see the Oracle Java SE Support Roadmap.
You can still get free public Java 8 LTS updates from 3rd-party vendors post 2020; see Java is Still Free for all of the details.
I can confirm the the ojdbc7.jar running on a JDK 7 will work connecting to an Oracle 19C server.
Looking at the Oracle JDBC FAQ it does not look like this is officially supported, however we have a current client in the process of upgrading their JDK, but we needed to support JDK 7 in the short term.
Our Oracle server was an AWS RDS instance, previously running Oracle 12C, but Amazon is no longer supporting this, and we were forced to upgrade to Oracle 19c.
We had some JDK 8 environments (container JBoss 7) which were already using ojdbc7.jar and these were fine. The JDK 7 environment (container JBoss 5.2) were using ojdbc6-11.2.0.1.0.jar and was failing with exception:
Caused by: java.sql.SQLException: ORA-28040: No matching
authentication protocol
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439) at
oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:388) at
oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:381) at
oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:427)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436) at
oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186) at
oracle.jdbc.driver.T4CTTIoauthenticate.doOSESSKEY(T4CTTIoauthenticate.java:390)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:356) at
oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:531)
at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:221)
at
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503) at
org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:207
After switching from ojdbc6-11.2.0.1.0.jar to: ojdbc7.jar the application functioned normally.
Just a caveat, I quickly tested our application read/writing to the DB, and these worked as expected, your mileage may vary, as mentioned above this is not officially supported.

Can no longer run jdbc with update

I recently updated from java 7 to 8 and jdbc will no longer run.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // classNotFoundException is thrown
is what i get now when I run it, where did I go wrong?
thanks
UCanAccess is a pure Java JDBC driver that allows us to read from and write to Access databases without using ODBC. It uses two other packages, Jackcess and HSQLDB, to perform these tasks.
sun.jdbc.odbc.JdbcOdbcDriver is Java internal class, it is not documented in the official Java SE javadoc and it should not be used by applications because it may change or totally disappear in a next Java version.

What is the right JDBC version for MySQL server 5.1.72?

I am a bit confused about what JDBC version to use for MySQL server 5.1.72.
Could you please tell me, what version I should use and why?
The following link http://www.mysql.com/products/connector/ provides a list of MySQL Connectors, choose the JDBC connector and the platform.
Table 2.1 in this page could help you.
Anyway manual states:
The current recommended version for Connector/J is 5.1. This guide covers all four connector versions, with specific notes given where a setting applies to a specific option.
JDBC version does not makes sense here either you were talking about JDBC API then available versions are
JDBC 3.0
JDBC 4.0 (included in Java SE 6)
JDBC 4.1, is specified by a maintenance release 1 of JSR 221
and is included in Java SE 7
The latest version, JDBC 4.2, is specified by a maintenance release 2 of JSR 221
and is included in Java SE 8.
And if you are talking about JDBC driver mysql then it is better to use the latest version available which is
Connector/J 5.1.31
It is always recommended to use the most stable version unless you find some compatibility issue.

Categories