我无法使用 JDBC 瘦驱动程序连接到 Oracle 数据库。相同的 URL 适用于 SQL*plus,但不适用于 JDBC Thin。我尝试使用 Java 17 和最新的 ojdbc JAR。
下面是我尝试过的Java代码
Class.forName("oracle.jdbc.driver.OracleDriver");
try (Connection con = DriverManager.getConnection(url, userName, password);
Statement stmt = con.createStatement();
ResultSet res = stmt.executeQuery("SELECT sysdate FROM DUAL")) {
System.out.println("Connection established");
System.out.println("statement executed");
while (res.next()) {
System.out.println(res.getString(1));
}
}
以下是错误日志。
2024-08-02T04:50:16.708-04:00 INFO 7310 --- [jdbc-connectivity] [nio-5432-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms
Connection establishment starts for URL--->jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<host_ip>)(PORT=8848))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=<service_name>)))
2024-08-02T04:51:17.233-04:00 INFO 7310 --- [jdbc-connectivity] [nio-5432-exec-1] oracle.jdbc : entering args (oracle.jdbc.internal.AbstractConnectionBuilder$1@61846e3a)
2024-08-02T04:51:17.234-04:00 INFO 7310 --- [jdbc-connectivity] [nio-5432-exec-1] oracle.jdbc : traceId=4E397AFF.
2024-08-02T04:51:17.238-04:00 INFO 7310 --- [jdbc-connectivity] [nio-5432-exec-1] oracle.jdbc : Session Attributes:
sdu=8192, tdu=2097152
nt: host=<host_ip>, port=8848, socketOptions={0=YES, 1=NO, 17=0, 18=false, 2=0, 20=true, 38=TLS, 23=40, 24=50, 40=false, 25=0}
socket=null
client profile={oracle.net.encryption_types_client=(), oracle.net.crypto_seed=, oracle.net.authentication_services=(), oracle.net.setFIPSMode=false, oracle.net.kerberos5_mutual_authentication=false, oracle.net.encryption_client=ACCEPTED, oracle.net.crypto_checksum_client=ACCEPTED, oracle.net.crypto_checksum_types_client=()}
connection options=[host=<host_ip> port=8848 protocol=tcp service_name=<service_name> addr=(ADDRESS=(PROTOCOL=tcp)(HOST=<host_ip>)(PORT=8848)) conn_data=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(PORT=8848)(HOST=<host_ip>))(CONNECT_DATA=(CID=(PROGRAM=JDBC Thin Client)(HOST=gms-prod-ha2)(USER=opc))(SERVER=DEDICATED)(SERVICE_NAME=<service_name>))) done=true]
onBreakReset=false, dataEOF=false, negotiatedOptions=0x841, connected=false
TTIINIT enabled=false, TTC cookie enabled=false
2024-08-02T04:51:17.238-04:00 INFO 7310 --- [jdbc-connectivity] [nio-5432-exec-1] oracle.jdbc : traceId=4E397AFF, anoEnabled=true.
2024-08-02T04:51:17.239-04:00 INFO 7310 --- [jdbc-connectivity] [nio-5432-exec-1] oracle.jdbc : Got Resend, SessionTraceId = 4E397AFF
2024-08-02T04:51:17.240-04:00 INFO 7310 --- [jdbc-connectivity] [nio-5432-exec-1] oracle.jdbc : Connection established. Cleared conn strategy stack
2024-08-02T04:51:17.240-04:00 INFO 7310 --- [jdbc-connectivity] [nio-5432-exec-1] oracle.jdbc : Sending break marker, SessionTraceId = 4E397AFF
2024-08-02T04:51:17.241-04:00 INFO 7310 --- [jdbc-connectivity] [nio-5432-exec-1] oracle.jdbc : throwing
java.sql.SQLRecoverableException: ORA-17002: I/O error: Connection reset, Authentication lapse 0 ms.
https://docs.oracle.com/error-help/db/ora-17002/
at oracle.jdbc.driver.T4CConnection.handleLogonIOException(T4CConnection.java:1660) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:1142) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:1206) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:105) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:886) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:693) ~[ojdbc11.jar!/:23.5.0.24.07]
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681) ~[java.sql:na]
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229) ~[java.sql:na]
at com.manh.gms.jdbc.JdbcService.connect(JdbcService.java:21) ~[!/:odbc-latest]
at com.manh.gms.jdbc.JdbcController.establishJdbcConnection(JdbcController.java:29) ~[!/:odbc-latest]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:255) ~[spring-web-6.1.11.jar!/:6.1.11]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:188) ~[spring-web-6.1.11.jar!/:6.1.11]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118) ~[spring-webmvc-6.1.11.jar!/:6.1.11]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:926) ~[spring-webmvc-6.1.11.jar!/:6.1.11]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:831) ~[spring-webmvc-6.1.11.jar!/:6.1.11]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-6.1.11.jar!/:6.1.11]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089) ~[spring-webmvc-6.1.11.jar!/:6.1.11]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979) ~[spring-webmvc-6.1.11.jar!/:6.1.11]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014) ~[spring-webmvc-6.1.11.jar!/:6.1.11]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903) ~[spring-webmvc-6.1.11.jar!/:6.1.11]
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:564) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) ~[spring-webmvc-6.1.11.jar!/:6.1.11]
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:195) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) ~[tomcat-embed-websocket-10.1.26.jar!/:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-6.1.11.jar!/:6.1.11]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.1.11.jar!/:6.1.11]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-6.1.11.jar!/:6.1.11]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.1.11.jar!/:6.1.11]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-6.1.11.jar!/:6.1.11]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.1.11.jar!/:6.1.11]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:483) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:389) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:904) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1741) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1190) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-10.1.26.jar!/:na]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) ~[tomcat-embed-core-10.1.26.jar!/:na]
at java.base/java.lang.Thread.run(Thread.java:842) ~[na:na]
Caused by: java.io.IOException: Connection reset, Authentication lapse 0 ms.
at oracle.jdbc.driver.T4CConnection.handleLogonIOException(T4CConnection.java:1655) ~[ojdbc11.jar!/:23.5.0.24.07]
... 59 common frames omitted
Caused by: java.net.SocketException: Connection reset
at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:394) ~[na:na]
at java.base/sun.nio.ch.SocketChannelImpl.blockingRead(SocketChannelImpl.java:1293) ~[na:na]
at java.base/sun.nio.ch.SocketAdaptor$1.read(SocketAdaptor.java:194) ~[na:na]
at oracle.net.nt.TimeoutSocketChannel.doBlockedRead(TimeoutSocketChannel.java:600) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.net.nt.TimeoutSocketChannel.read(TimeoutSocketChannel.java:536) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.net.ns.NSProtocolNIO.doSocketRead(NSProtocolNIO.java:1224) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.net.ns.NIOPacket.readHeader(NIOPacket.java:272) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.net.ns.NIOPacket.readPacketFromSocketChannel(NIOPacket.java:205) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.net.ns.NIOPacket.readFromSocketChannel(NIOPacket.java:148) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.net.ns.NIOPacket.readFromSocketChannel(NIOPacket.java:121) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.net.ns.NIONSDataChannel.readDataFromSocketChannel(NIONSDataChannel.java:111) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.jdbc.driver.T4CMAREngineNIO.prepareForUnmarshall(T4CMAREngineNIO.java:930) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.jdbc.driver.T4CMAREngineNIO.unmarshalUB1(T4CMAREngineNIO.java:464) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.jdbc.driver.T4C8TTIdty.receivePacket(T4C8TTIdty.java:926) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.jdbc.driver.T4C8TTIdty.doRPC(T4C8TTIdty.java:776) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.jdbc.driver.T4CConnection.negotiateSession(T4CConnection.java:3522) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.jdbc.driver.T4CConnection.negotiateTTC(T4CConnection.java:893) ~[ojdbc11.jar!/:23.5.0.24.07]
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:1078) ~[ojdbc11.jar!/:23.5.0.24.07]
... 58 common frames omitted
2024-08-02T04:51:17.248-04:00 INFO 7310 --- [jdbc-connectivity] [nio-5432-exec-1] oracle.jdbc : properties={LOCALE=en_US, DriverVersion=23.5.0.24.07, java.library.path: =/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib, java.class.path: =jdbc-odbc-latest.jar, java.version: =17.0.12}.
java.sql.SQLRecoverableException: ORA-17002: I/O error: Connection reset, Authentication lapse 0 ms.
https://docs.oracle.com/error-help/db/ora-17002/
at oracle.jdbc.driver.T4CConnection.handleLogonIOException(T4CConnection.java:1660)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:1142)
at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:1206)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:105)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:886)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:693)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229)
at com.manh.gms.jdbc.JdbcService.connect(JdbcService.java:21)
at com.manh.gms.jdbc.JdbcController.establishJdbcConnection(JdbcController.java:29)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:255)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:188)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:926)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:831)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:564)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:195)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:483)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:389)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:904)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1741)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1190)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)
at java.base/java.lang.Thread.run(Thread.java:842)
Caused by: java.io.IOException: Connection reset, Authentication lapse 0 ms.
at oracle.jdbc.driver.T4CConnection.handleLogonIOException(T4CConnection.java:1655)
... 59 more
Caused by: java.net.SocketException: Connection reset
at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:394)
at java.base/sun.nio.ch.SocketChannelImpl.blockingRead(SocketChannelImpl.java:1293)
at java.base/sun.nio.ch.SocketAdaptor$1.read(SocketAdaptor.java:194)
at oracle.net.nt.TimeoutSocketChannel.doBlockedRead(TimeoutSocketChannel.java:600)
at oracle.net.nt.TimeoutSocketChannel.read(TimeoutSocketChannel.java:536)
at oracle.net.ns.NSProtocolNIO.doSocketRead(NSProtocolNIO.java:1224)
at oracle.net.ns.NIOPacket.readHeader(NIOPacket.java:272)
at oracle.net.ns.NIOPacket.readPacketFromSocketChannel(NIOPacket.java:205)
at oracle.net.ns.NIOPacket.readFromSocketChannel(NIOPacket.java:148)
at oracle.net.ns.NIOPacket.readFromSocketChannel(NIOPacket.java:121)
at oracle.net.ns.NIONSDataChannel.readDataFromSocketChannel(NIONSDataChannel.java:111)
at oracle.jdbc.driver.T4CMAREngineNIO.prepareForUnmarshall(T4CMAREngineNIO.java:930)
at oracle.jdbc.driver.T4CMAREngineNIO.unmarshalUB1(T4CMAREngineNIO.java:464)
at oracle.jdbc.driver.T4C8TTIdty.receivePacket(T4C8TTIdty.java:926)
at oracle.jdbc.driver.T4C8TTIdty.doRPC(T4C8TTIdty.java:776)
at oracle.jdbc.driver.T4CConnection.negotiateSession(T4CConnection.java:3522)
at oracle.jdbc.driver.T4CConnection.negotiateTTC(T4CConnection.java:893)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:1078)
... 58 more
我尝试使用 Java 17 和最新的 ojdbc11 JAR。
请先确认使用的数据库版本。该错误表明数据库由于某种原因正在关闭连接。您可以检查数据库日志以获取有关错误的更多详细信息。从错误日志来看,您似乎正在客户端使用加密设置,您是否尝试禁用它们?
{oracle.net.encryption_types_client=(), oracle.net.crypto_seed=, oracle.net.authentication_services=(),
oracle.net.setFIPSMode = false,oracle.net.kerberos5_mutual_authentication = false,oracle.net.encryption_client = 已接受,
oracle.net.crypto_checksum_client=已接受,oracle.net.crypto_checksum_types_client=()}