Skip to content
Advertisement

Can’t connect to Oracle 19.3 with 19.3 JDBC driver

We have a project running with an Oracle 19.3 database, and a Java application using the Oracle 19.3 JDBC driver (which is available on Maven Central). On Windows with JRE 1.8, everything is fine, but when I run either on our build server or in WSL Ubuntu with OpenJDK 11.0.3 it refuses to connect to the database. Specifically:

ERROR: Unexpected error
java.sql.SQLRecoverableException:
Unable to obtain connection from database (jdbc:oracle:thin:@//<host>:<port>/<db>) for user '<user>': IO Error: Invalid argument, Authentication lapse 0 ms.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL State  : 08006
Error Code : 17002
Message    : IO Error: Invalid argument, Authentication lapse 0 ms.

        at JuliasApplication.openConnection(JdbcUtils.java:60)
        ...
Caused by: java.sql.SQLRecoverableException: IO Error: Invalid argument, Authentication lapse 0 ms.
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:874)
        at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:793)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:57)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:747)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:562)
        ...
Caused by: java.io.IOException: Invalid argument, Authentication lapse 0 ms.
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:870)
        ... 12 more
Caused by: java.io.IOException: Invalid argument
        at java.base/sun.nio.ch.SocketChannelImpl.sendOutOfBandData(Native Method)
        at java.base/sun.nio.ch.SocketChannelImpl.sendOutOfBandData(SocketChannelImpl.java:521)
        at java.base/sun.nio.ch.SocketAdaptor.sendUrgentData(SocketAdaptor.java:323)
        at oracle.net.nt.TcpNTAdapter.sendUrgentByte(TcpNTAdapter.java:433)
        at oracle.net.ns.NSProtocolNIO.negotiateConnection(NSProtocolNIO.java:159)
        at oracle.net.ns.NSProtocol.connect(NSProtocol.java:340)
        at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1596)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:588)
        ... 12 more

If I switch in the 18.3 JDBC driver everything is fine in both environments; if I switch in an 18.3 database everything is fine in both environments. That does give us a workaround for now, but it feels very uncomfortable that we don’t understand what’s going on. And I can’t find anything online about an “Authentication lapse”. Can anyone see any clues which would explain the failure?

Advertisement

Answer

It looks like the underlying Socket implementation is not allowing OOB. As a workaround, you can disable the OOB check by setting the connection property CONNECTION_PROPERTY_THIN_NET_DISABLE_OUT_OF_BAND_BREAK to “true”. Please refer this link : https://docs.oracle.com/en/database/oracle/oracle-database/20/jajdb/oracle/jdbc/OracleConnection.html#CONNECTION_PROPERTY_THIN_NET_DISABLE_OUT_OF_BAND_BREAK

The link above no longer mentions the “out of band break” issue, so here’s some alternatives:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement