Search code examples
javaoraclespring-bootjdbcojdbc

How to select correct ojdbc version accourding to Oracle FAQ?


I know there is some questions about this but none of these are not telling how to choose. So I have oracle database version 19c and jdk 17 microservice. When I look Oracle FAQ I have 3 options to use.

JDBC and RDBMS interoperability matrix

Also as I told, I have jdk 17. That means I can use ojdbc10 or ojdbc8.

Oracle JDBC releases Vs JDK

I let my spring boot parent to choose by not give version as in pom

<dependency>
    <groupId>com.oracle.database.jdbc</groupId>
    <artifactId>ojdbc8</artifactId>
</dependency>
<dependency>
    <groupId>com.oracle.database.nls</groupId>
    <artifactId>orai18n</artifactId>
</dependency>

and when I mvn install I can see it installs jdbc 21.9.0.0. As far as I can tell, it will work with database 19.x when I look first chart. But I'm not sure about it's compatible with JDK17. Second chart tells ojdbc8 with database 19.x is fully compatible with JDK17 but how is it? Shouldn't this chart be in the form jdbc version x jdbc jar. What does jdk have to do with database version?


Solution

  • The library name is "ojdbc8" and that indicates that it was compiled with Java 8 and therefore implements the JDBC 4.2 spec. The 21c JDBC driver is compatible with the 19c server. With JDK17 you can use either ojdbc8.jar or ojdbc10.jar. If you are planning to use the JDBC 4.3 APIs then you should use ojdbc10.jar.