Oracle: Connection intermittent issue using JDBC url
Find the problem, in short the issue can be solved either of the two choices:
- Increase the size of connections allowed by Oracle
- 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
How to Fix a Compilation Error for Unhandled Exception on Call to Thread.Sleep()
Invalid Signature File Digest for Manifest Main Attributes Exception While Trying to Run Jar File
Accessing Post Variables Using Java Servlets
Converting to Upper and Lower Case in Java
Find an Array Inside Another Larger Array
Filling Combobox from Database by Using Hibernate in Java
How to Quickly Determine If a Method Is Overridden in Java
Pdfbox - Signature Validity Checkmark Not Visible in Acrobat Reader
Javax.Mail.Authenticationfailedexception Is Thrown While Sending Email in Java
How to Achieve Transfer File Between Client and Server Using Java Socket
In Which Thread Do Completablefuture's Completion Handlers Execute
In Java, Differencebetween This.Method() and Method()
Java.Lang.Noclassdeffounderror: Org.Slf4J.Loggerfactory
How to View Bytecode of Class File
Auto Adjust the Height of Rows in a Jtable
Tablecellrenderer and How to Refresh Cell Background Without Using Jtable.Repaint()