JDBC and Oracle 11g reset connection on ubuntu

I am having this strange problem connecting JDBC to Oracle 11g. Suddenly, this start occurred this Monday without any changes to the settings that I or the team knew. Reading in Stackoverflow and Oracle blocks (see links below). I found out that there was a problem with generating random bytes on 64-bit Linux machines. This made me try a few things that, unfortunately, did not work. Here is a brief overview of all the information that I know of.

The strange thing is that I can connect through the terminal using sqlplus but not using JDBC.

Thanks for any ideas or help,

Amit

My setup:

OS: Ubuntu 12.04
Java: Both 7 and 6_45 (Issue is the same)
JDBC: Downloaded from the Oracle official site (see further description down)
    Connection behind a Cisco VPN

JDBC manifests:

odbc7.jar:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 20.12-b01 (Sun Microsystems Inc.)
Implementation-Vendor: Oracle Corporation
Implementation-Title: JDBC
Implementation-Version: 12.1.0.1.0
Repository-Id: JAVAVM_12.1.0.1.0_LINUX.X64_130403
Specification-Vendor: Sun Microsystems Inc.
Specification-Title: JDBC
Specification-Version: 4.0
Main-Class: oracle.jdbc.OracleDriver
sealed: true

Name: oracle/sql/converter/
Sealed: false

Name: oracle/sql/
Sealed: false

Name: oracle/sql/converter_xcharset/
Sealed: false

odbc6.jar:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 20.12-b01 (Sun Microsystems Inc.)
Implementation-Vendor: Oracle Corporation
Implementation-Title: JDBC
Implementation-Version: 12.1.0.1.0
Repository-Id: JAVAVM_12.1.0.1.0_LINUX.X64_130403
Specification-Vendor: Sun Microsystems Inc.
Specification-Title: JDBC
Specification-Version: 4.0
Main-Class: oracle.jdbc.OracleDriver
sealed: true

Name: oracle/sql/converter/
Sealed: false

Name: oracle/sql/
Sealed: false

Name: oracle/sql/converter_xcharset/
Sealed: false

Friday still worked:

  • Java- Java.
  • :
  • (Ubuntu 12.04) , , , .

SQLPLUS:

amit @mymachine:/usr/lib/oracle $sqlplus/@DB_HOST_IP: 1521/DB_NAME

SQL * Plus: Release 12.1.0.1.0 Production 22 11:35:58 2014

Copyright (c) 1982, 2013, Oracle. .

: Oracle Database 11g Release 11.2.0.3.0 - 64bit Production

SQL >

JDBC :

DriverManager.getConnection(
                    "jdbc:oracle:thin:@//DB_HOST_IP:1521/DB_NAME", username,
                    password);

20 :

ava.sql.SQLRecoverableException: IO Error: Connection reset
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:682)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:711)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:385)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:558)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at OracleJDBC.main(OracleJDBC.java:32)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:168)
    at oracle.net.ns.Packet.receive(Packet.java:311)
    at oracle.net.ns.DataPacket.receive(DataPacket.java:105)
    at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:305)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:249)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:171)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:89)
    at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:123)
    at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:79)
    at oracle.jdbc.driver.T4CMAREngineStream.unmarshalUB1(T4CMAREngineStream.java:426)
    at oracle.jdbc.driver.T4C8TTIdty.receive(T4C8TTIdty.java:688)
    at oracle.jdbc.driver.T4C8TTIdty.doRPC(T4C8TTIdty.java:595)
    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1439)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:486)
    ... 12 more

:

Fatal NI connect error 12170.

  VERSION INFORMATION:
        TNS for Linux: Version 11.2.0.3.0 - Production
        Oracle Bequeath NT Protocol Adapter for Linux: Version
11.2.0.3.0 - Production
        TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.3.0 - Production
  Time: 22-APR-2014 09:57:45
  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
  Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=<my.ip.address>)(PORT=42738))

Oracle :

ORA-12535: TNS:operation timed out
Cause: The requested operation could not be completed within the time out period.
Action: Look at the documentation on the secondary errors for possible remedy. See SQLNET.LOG to find secondary error if not provided explicitly. Turn on tracing to gather more information.

ORA-12606: TNS: Application timeout occurred
Cause: A network session did not reach an application-defined stage within the allowed time interval.
Action: This is an error which does not normally appear at the high level. The action to take is application specific, and is detailed in the higher level error description.

, :

  • -Djava.security.egd=file:///dev/urandom, Stackoverflow.
  • rng-, "" . (. )

  • - ( -Djava.security.egd:

int a = 10000; while (a-- > 0){ byte[] array = new byte[2048]; new SecureRandom().nextBytes(array); System.out.println(a); }

, , (-).

EDIT: :

  1. , . CLOG 1-2 .

SQL> select secure_params from session_token where id=11065073; < - .

,

, , 429, , 587 , .

    SQL>  select length( secure_params) from session_token where id=11065073;

    LENGTH(SECURE_PARAMS)
    ---------------------
                      587

SQL> select secure_params from session_token where id=11065073; < - .

Attemps number 4 , , , , .

:

Stackoverflow: JDBC Oracle

Rng: http://www.howtoforge.com/helping-the-random-number-generator-to-gain-enough-entropy-with-rng-tools-debian-lenny

+4
1
+2

Source: https://habr.com/ru/post/1537485/


All Articles