Oracle Jdbc Intermittent Connection Issue

Oracle: Connection intermittent issue using JDBC url

Find the problem, in short the issue can be solved either of the two choices:

  1. Increase the size of connections allowed by Oracle
  2. Decrease the size of connections allowed by JNDI

The 1st solution is operated by DBA, but the second can be implemented by developer, in my application's JNDI settings(We test JNDI on Tomcat), the max connections allowed to the pool is too many to current Oracle service can handle:

<Resource name="jdbc/schema_A" auth="Container" type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@hostname:1521:orcl"
username="app_A" password="app_A" maxActive="20" maxIdle="10" maxWait="-1" />

maxActive="20" maxIdle="10" is too much hence the error message, so I change it to

<Resource name="jdbc/schema_A" auth="Container" type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@hostname:1521:orcl"
username="app_A" password="app_A" maxActive="1" maxIdle="1" maxWait="-1" />

Now everything is working without issues...cheers..

Getting intermittent error java.sql.SQLException: ORA-01005: null password given; logon denied issue

This issue got resolved by upgrading Oracle JDBC driver to 12.1.0.1 version.

<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.1</version>
</dependency>

Java OracleDB connection taking too long the first time

You are probably running into an issue with the Oracle JDBC driver which uses a blocking random number generator by default on Linux. Try running Java with the following argument:

-Djava.security.egd=file:/dev/./urandom

Alternatively you could start up a daemon to feed the random number generator. The Linux "rngd" daemon is an example.

Sources:

  • http://www.usn-it.de/index.php/2009/02/20/oracle-11g-jdbc-driver-hangs-blocked-by-devrandom-entropy-pool-empty/
  • http://bugs.java.com/view_bug.do;?bug_id=6521844
  • https://bugs.openjdk.java.net/browse/JDK-6202721
  • https://community.oracle.com/message/3701989
  • Oracle JDBC intermittent Connection Issue
  • Oracle getConnection slow
  • How to solve performance problem with Java SecureRandom?

Oracle jdbc connection takes long time, then java.sql.SQLRecoverableException: IO Error: Broken pipe

Cause:

The problem could be lookup issues between IPv6 versus IPv4. If the Domain Name System (DNS) server is not configured to handle IPv6 queries, the application may have to wait for the IPv6 query to time out for IPv6 queries.

These threads are waiting for a response for an IPv6 query. It is likely the the DNS server is not responding to the IPv6 query.

at java.net.Inet6AddressImpl.getLocalHostName(Native Method)
at java.net.InetAddress.getLocalHost(InetAddress.java:123)

Solution:

My system only uses IPv4, so I set the following argument for batch command.

java -Djava.net.preferIPv4Stack=true ...

And Now It is Okay.

reference:
http://www-01.ibm.com/support/docview.wss?uid=swg21170467



Related Topics



Leave a reply



Submit