This issue is found on Oracle JDBC driver 11.2.x.
- Environment : Linux virtual server, Oracle JDBC driver 11.2.x
- Issue : Oracle connection takes long time or occurs timeout error
- Cause : Oracle JDBC driver, when it connect to database server, calls java.security.SecureRandom class. SecureRandom uses /dev/random on Linux or Unix server. /dev/random pseudo device uses some noises from keyboard, mouse or some device drivers to make sufficient entropy. But virtual server usually don’t get enough noises within short time. Therefore, SecureRandom can be slow or hang in generating random value. (This is not a bug. Refer to the following Javadoc)
- Workaround : Use /dev/urandom instead of /dev/random with the following option
-Djava.security.egd=file:/dev/../dev/urandom
or
-Djava.security.egd=file:/dev/./urandom
or
-Djava.security.egd=file:///dev/urandom