无法通过19.3 JDBC驱动程序连接到Oracle 19.3

问题描述 投票:1回答:1

我们有一个运行Oracle 19.3数据库的项目,以及一个使用Oracle 19.3 JDBC驱动程序的Java应用程序(可在Maven Central上找到)。在带有JRE 1.8的Windows上,一切都很好,但是当我在构建服务器上运行或在具有OpenJDK 11.0.3的WSL Ubuntu中运行时,它拒绝连接到数据库。具体来说:

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

如果我切换到18.3 JDBC驱动程序,则在两种环境下都可以;如果我切换到18.3数据库,在两种环境下都可以。这确实为我们提供了一种解决方法,但是对于我们不了解发生了什么感到非常不舒服。而且我在网上找不到有关“身份验证失效”的任何信息。谁能看到任何线索来解释失败吗?

java oracle jdbc
1个回答
0
投票

您必须使用与JDK10兼容的ojdbc10.jar。有关更多详细信息,请参见FAQ (What are the Oracle JDBC releases Vs JDK versions?)

19.3使用JDK10,JDK11的ojdbc10.jar和使用JDK8,JDK9,JDK11的ojdbc8.jar具有JDK8,JDK9,JDK10,JDK11的18.3 ojdbc8.jar

© www.soinside.com 2019 - 2024. All rights reserved.