Oracle JDBC intermittent Connection Issue?

I was facing exactly the same problem. With Windows Vista I could not reproduce the problem but on Ubuntu I reproduced the 'connection reset'-Error constantly.

Up vote 4 down vote favorite share g+ share fb share tw.

I am experiencing a very strange problem This is a very simple use of JDBC connecting to an Oracle database OS: Ubuntu Java Version: 1.5.0_16-b02 1.6.0_17-b04 Database: Oracle 11g Release 11.1.0.6.0 When I make use of the jar file JODBC14. Jar it connects to the database everytime When I make use of the jar file JODBC5. Jar it connects some times and other times it throws an error ( shown below) If I recompile with Java 6 and use JODBC6.

Jar I get the same results as JODBC5. Jar I need specific features in JODB5. Jar that are not available in JODBC14.

Jar Any ideas Error > Connecting to oracle java.sql. SQLException: Io exception: Connection reset at oracle.jdbc.driver.SQLStateMapping. NewSQLException(SQLStateMapping.

Java:74) at oracle.jdbc.driver.DatabaseError. NewSQLException(DatabaseError. Java:110) at oracle.jdbc.driver.DatabaseError.

ThrowSqlException(DatabaseError. Java:171) at oracle.jdbc.driver.DatabaseError. ThrowSqlException(DatabaseError.

Java:227) at oracle.jdbc.driver.DatabaseError. ThrowSqlException(DatabaseError. Java:494) at oracle.jdbc.driver.

T4CConnection. Logon(T4CConnection. Java:411) at oracle.jdbc.driver.

PhysicalConnection.(PhysicalConnection. Java:490) at oracle.jdbc.driver. T4CConnection.(T4CConnection.

Java:202) at oracle.jdbc.driver. T4CDriverExtension. GetConnection(T4CDriverExtension.

Java:33) at oracle.jdbc.driver.OracleDriver. Connect(OracleDriver. Java:474) at java.sql.DriverManager.

GetConnection(DriverManager. Java:525) at java.sql.DriverManager. GetConnection(DriverManager.

Java:171) at TestConnect. Main(TestConnect. Java:13) Code Below is the code I am using import java.io.

*; import java.sql. *; public class TestConnect { public static void main(String args) { try { System.out. Println("Connecting to oracle"); Connection con=null; Class.

ForName("oracle.jdbc.driver. OracleDriver"); con=DriverManager. GetConnection( "jdbc:oracle:thin:@172.16.48.100:1535:sample", "JOHN", "90009000"); System.out.

Println("Connected to oracle"); con.close(); System.out. Println("Goodbye"); } catch(Exception e) { e.printStackTrace(); } } } java oracle jdbc link|improve this question edited Oct 8 '10 at 21:35Rob Hruska15.2k53072 asked Feb 24 '10 at 15:38Lipska2112.

I was facing exactly the same problem. With Windows Vista I could not reproduce the problem but on Ubuntu I reproduced the 'connection reset'-Error constantly. I found forums.oracle.com/forums/thread.jspa?thr... which solved my problem.

There is a solution provided to this problem in some of the OTN forums (kr.forums.oracle.com/forums/thread.jspa?...). But, the root cause of the problem is not explained. Following is my attempt to explain the root cause of the problem.

The Oracle JDBC drivers communicate with the Oracle server in a secure way. The drivers use the java.security. SecureRandom class to gather entropy for securing the communication.

This class relies on the native platform support for gathering the entropy. Entropy is the randomness collected/generated by an operating system or application for use in cryptography or other uses that require random data. This randomness is often collected from hardware sources, either from the hardware noises, audio data, mouse movements or specially provided randomness generators.

The kernel gathers the entropy and stores it is an entropy pool and makes the random character data available to the operating system processes or applications through the special files /dev/random and /dev/urandom. Reading from /dev/random drains the entropy pool with requested amount of bits/bytes, providing a high degree of randomness often desired in cryptographic operations. In case, if the entropy pool is completely drained and sufficient entropy is not available, the read operation on /dev/random blocks until additional entropy is gathered.

Due to this, applications reading from /dev/random may block for some random period of time. In contrast to the above, reading from the /dev/urandom does not block. Reading from /dev/urandom, too, drains the entropy pool but when short of sufficient entropy, it does not block but reuses the bits from the partially read random data.

This is said to be susceptible to cryptanalytical attacks. This is a theorotical possibility and hence it is discouraged to read from /dev/urandom to gather randomness in cryptographic operations. The java.security.

SecureRandom class, by default, reads from the /dev/random file and hence sometimes blocks for random period of time. Now, if the read operation does not return for a required amount of time, the Oracle server times out the client (the jdbc drivers, in this case) and drops the communication by closing the socket from its end. The client when tries to resume the communication after returning from the blocking call encounters the IO exception.

This problem may occur randomly on any platform, especially, where the entropy is gathered from hardware noises. As suggested in the OTN forum, the solution to this problem is to override the default behaviour of java.security. SecureRandom class to use the non-blocking read from /dev/urandom instead of the blocking read from /dev/random.

This can be done by adding the following system property -Djava.security. Egd=file:///dev/urandom to the JVM. Though this is a good solution for the applications like the JDBC drivers, it is discouraged for applications that perform core cryptographic operations like crytographic key generation.

Other solutions could be to use different random seeder implementations available for the platform that do not rely on hardware noises for gathering entropy. With this, you may still require to override the defualt behaviour of java.security.SecureRandom. Increasing the socket timeout on the Oracle server side can also be a solution but the side effects should be assessed from the server point of view before attempting this.

It's hard to say, but if I would check the actual version of the JDBC driver. Make sure it's 11.1.0.6. Oracle doesn't include the database version in the filename.

So the driver for 11.2 is the exact same name as the driver for 11.1 - ojdbc5.jar. I would extract the driver jar file, and find the MANIFEST. MF file, this will contain some version information.

Make sure the version of the JDBC driver matches the version of your database. I suspect it may be a version issue, since there isn't a jar file named ojdbc14. Jar on Oracle's 11.1.0.6 download page.

If the version matches - I'm out of ideas :).

I found this link for the same problem with 64bit system, driver jdbc 11g and connection reset: forums.oracle.com/forums/thread.jspa?mes....

A "connection reset" error message generally means that the other side has aborted the connection during the attempt to create a connection (the handshake). This has a lot of possible causes. A bug in the JDBC driver, a timeout at the DB side, a restart of the database, the DB being run out of available connections, poor network quality, bad virusscanner/firewall/proxy, etc. As it happens intermittely, a bug in the JDBC driver can be less or more excluded.

Left behind the remaining possible causes. I suggest to start with looking in the logs of the DB server.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions