I have a very simple java program (see below) on my application server that successfully connects to the Oracle 11.2 database on the database server (both servers are Linux CentOS) using the thin JDBC driver from Oracle.
As you can see from the setURL command in the Java code below, I configured the application and database server so that they sit next to each other and they are on the same network (a cross-cable connected to each other), so there is no network traffic to these (development) boxes except my code.
The problem is that the execution time varies greatly. If I ran it 5 times, it (seemingly by accident) could take 0.01 seconds, or 10 seconds, or 50 seconds, or more minutes to complete. If it takes a minute (approximately), the program will not be completed, but instead the error shown below will be shown.
Any ideas what can be done here?
gn@host7 [~/fd]
Exception in thread "main" java.sql.SQLRecoverableException: IO Error: Connection reset
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:494)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:547)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:225)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:29)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:556)
at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:454)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:328)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:233)
at J.main(J.java: line 16)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:96)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at oracle.net.ns.DataPacket.send(DataPacket.java:219)
at oracle.net.ns.NetOutputStream.flush(NetOutputStream.java:208)
at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:224)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:172)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:97)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:82)
at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:120)
at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:76)
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1158)
at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1134)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:307)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:199)
at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:365)
at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:812)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:411)
... 8 more
Java code for: J.java:
import java.sql.*;
import oracle.jdbc.*;
import oracle.jdbc.pool.OracleDataSource;
class J {
public static void main(String args[]) throws SQLException {
Connection conn;
OracleDataSource ds = new OracleDataSource();
ds.setURL("jdbc:oracle:thin:hr/hrpwd@192.168.0.1:1973:mySID");
conn = ds.getConnection();
DatabaseMetaData meta = conn.getMetaData();
System.out.println("Database version is " + meta.getDriverVersion());
if ( conn != null ) {
try { conn.close(); } catch ( Exception ex ) {}
conn = null;
}
}
}
UPDATE 1:
This looks like a potential error:
http://www.usn-it.de/index.php/2009/02/20/oracle-11g-jdbc-driver-hangs-blocked-by-devrandom-entropy-pool-empty/
Does anyone know how to really implement the solution provided there (see paragraph 3 at the end - where can I find this -Djava.security.egd=file:///dev/urandomto change it?)
source
share