This is interface incompatibility. javax.sql.DataSource
defines a method
default ConnectionBuilder createConnectionBuilder() throws SQLException
And as per the contract the return value requires to be of type ConnectionBuilder.
If you take a look at documentation of oracle.ucp.jdbc.PoolDataSourceImpl, it defines the method as
public UCPConnectionBuilder createConnectionBuilder()
whereas oracle.ucp.jdbc.UCPConnectionBuilder
is not a subtype of java.sql.ConnectionBuilder
.
Now unless Oracle releases a never version of oracle.ucp.jdbc.UCPConnectionBuilder
interface that extends java.sql.ConnectionBuilder
, you will not be able to interchange UCP PoolDataSource with javax.sql.DataSource
.
The latest release at this point appears to be UCP 19.3, which would still hit the same problem which is unfortunate since 19.3 is advertised as JDK11 compliant. Please raise a bug against Oracle UCP to make the maintainers aware of the new entrant createConnectionBuilder in the DataSource interface.
In the intrim, if it is feasible, you may fall back to using 11g release 2 of UCP (not 12, not 19) which does not have the method createConnectionBuilder on the PoolDataSource interface. Not an ideal situation, since you are giving up on a decade worth of improvements in UCP by going back to 11g.