Forum Stats

  • 3,816,609 Users
  • 2,259,213 Discussions
  • 7,893,518 Comments

Discussions

Oracle JDBC Driver throwing "Got minus one from a read call"

User_6FWIQ
User_6FWIQ Member Posts: 3 Green Ribbon

Hi there,

I'm using a Docker container with Oracle 19c version 19.3.0.0.0 at my machine. I started the container with -p 1521:1521 argument as well. So, for check if is ok, I connected to database via DBeaver and executed some queries. Everything was ok.

However, when I tried to start a Wildfly with ojdbc8.jar JDBC Driver (21c, 19c, 18c, and 12.2 supports) downloaded from Oracle site I got the follow error at server log.

Server Log

Caused by: java.sql.SQLRecoverableException: IO Error: Got minus one from a read call

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:854)

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)

at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:321)

... 86 more

Caused by: oracle.net.ns.NetException: Got minus one from a read call

at oracle.net.ns.NSProtocolNIO.doSocketRead(NSProtocolNIO.java:557)

at oracle.net.ns.NIOPacket.readHeader(NIOPacket.java:258)

at oracle.net.ns.NIOPacket.readPacketFromSocketChannel(NIOPacket.java:190)

at oracle.net.ns.NIOPacket.readFromSocketChannel(NIOPacket.java:132)

at oracle.net.ns.NIOPacket.readFromSocketChannel(NIOPacket.java:105)

at oracle.net.ns.NIONSDataChannel.readDataFromSocketChannel(NIONSDataChannel.java:91)

at oracle.net.ano.AnoCommNIO.p(Unknown Source)

at oracle.net.ano.AnoCommNIO.e(Unknown Source)

at oracle.net.ano.AnoComm.readUB4(Unknown Source)

at oracle.net.ano.Ano.c(Unknown Source)

at oracle.net.ano.Ano.negotiation(Unknown Source)

at oracle.net.ns.NSProtocol.connect(NSProtocol.java:368)

at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1596)

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:588)

... 91 more

I looked inside Docker container database log and I saw the follow error at same time

Database Log

Fatal NI connect error 12170, connecting to:

 (ADDRESS=(PROTOCOL=tcp)(HOST=172.17.0.1)(PORT=52244))

 VERSION INFORMATION:

TNS for Linux: Version 19.0.0.0.0 - Production

Oracle Bequeath NT Protocol Adapter for Linux: Version 19.0.0.0.0 - Production

TCP/IP NT Protocol Adapter for Linux: Version 19.0.0.0.0 - Production

 Version 19.3.0.0.0

 Time: 08-APR-2022 11:35:55

 Tracing not turned on.

 Tns error struct:

  ns main err code: 12535

 TNS-12535: TNS:operation timed out

  ns secondary err code: 12606

  nt main err code: 0

  nt secondary err code: 0

  nt OS err code: 0

Also, I started some networks checks like telnet 127.0.0.1 1521 and connection was ok. After that, I figured it was a kind of driver problem because DBeaver was connecting normally at same database.

So, I exchanged Wildfly JDBC driver by DBeaver driver. After that, Wildfly started without any error. My application did queries like expected.

I concluded that it is a driver issue because DBeaver had ojdbc8.jar that it was build to 12.2.0.1.0 database version. The Wildfly jar that I downloaded from Oracle website that it was build to 21.5.0.0.0 database version. I tested another one it was build to 19.3.0.0 but I had the same problem.

Some one from Oracle could analyze these information to be sure if it is a driver issue?

Workaround

After some researches at Google, I found a workaround that works for me without change the JDBC driver. Instead of using 127.0.0.1 or localhost I setup my connection with hosted IP machine. It is works fine. However it is very bad need to do that.

Tagged: