OracleDataSource cannot implement createConnectionBuilder() in javax.sql.Datasource

41 Views Asked by At

I am currently working on upgrading from Java 8 to 11 for my employer but we are running into an issue that we can't seem to figure out and can't find any help via other posts anywhere. Essentially when doing a maven install, the build fails with the 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 looked all over to see what is going on with this, tried to update versions in the pom. When looking at the java class it points at, there is no javax.sql.DataSource in the class anywhere and the line is pointing at the class declaration where OracleDataSource is implemented. There is only one class where we import javax.sql.DataSource but I can't seem to find any link between that class and the other one using the OracleDataSource, so I'm at a bit of a loss. I get the feeling I'm missing something very easy and I'm overlooking it or something. Thanks in advance for any help!

Have tried to update other dependencies within the pom, have tried to clean and then install with maven outside of our custom build script. Have tried altering imports of the OracleDataSource (we import oracle.jdbc.pool and tried to change to oracle.jdbc.datasourc.impl)

1

There are 1 best solutions below

1
Alexander Petrov On

What it means is that your driver is not compatible with Java 11 and does not implement the new method derived from the java 11 version of javax.sql.DataSource - createConnectionBuilder

You need to upgrade the Oracle driver to a version compatible with java 11.

Here is a list of the oracle drivers with their respective java version: https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html