javamavenojdbc

OracleConnectionBuilderImpl is not compatible with java.sql.ConnectionBuilder


I asked this question before but really didn't get too far with any results. I stopped for a bit and have returned to attempt to get this to work. I'm upgrading from Java 8 to Java 11 on our repository and when attempting to run mvn install I get this error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project <project>: Compilation failure
[ERROR] <project>.java:[15,8] createConnectionBuilder() in oracle.jdbc.datasource.impl.OracleDataSource cannot implement createConnectionBuilder() in javax.sql.DataSource
[ERROR]   return type oracle.jdbc.datasource.impl.OracleConnectionBuilderImpl is not compatible with java.sql.ConnectionBuilder

I've searched all over for anything about what this might be and the only real thing I got was that ojdbc8 might be the wrong version. I updated our pom.xml to the most recent version of OJDBC8 (19.3.0.0 -> 23.3.0.23.09):

<dependency>
  <groupId>com.oracle.database.jdbc</groupId>
  <artifactId>ojdbc8</artifactId>
  <version>23.3.0.23.09</version>
</dependency>

Here is the class the error is referencing, I'm unable to see anywhere where there might be an issue as there wasn't one on Java 8 and the code itself seems fine:

import oracle.jdbc.pool.OracleDataSource;
import org.springframework.security.crypto.encrypt.Encryptors;

import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;


public class MtDataSource extends OracleDataSource {

    public MtDataSource() throws SQLException {
        super();
    }
}

I don't find any link between the oracleDataSource and anything with CreateConnectionBuilder that would be tied back to this class from javax.sql.DataSource or java.sql.ConnectionBuilder.

Looking for any advice as I'm completely lost as to what is causing the compile issue. Thanks!

I've attempted trying different versions of OJDBC8 in the pom.xml, have tried different versions of maven-compiler-plugin, have tried cleaning before install.


Solution

  • Please use ojdbc11.jar instead of ojdbc8, then it will work fine, just update the artifact id from ojdbc8 to ojdbc11 in your pom.xml.