This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
My application uses a CustomRegistry on WAS 5 to ensure its security. Works fine most of the time, but if the db is not present at startup, the registry is supposed to loop every 10s to see if the db is back. The first time, I have the following exception : java.sql.SQLException: Exception d'E/S: The Network Adapter could not establish the connection at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333) at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:404) at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314) at java.sql.DriverManager.getConnection(DriverManager.java:543) at java.sql.DriverManager.getConnection(DriverManager.java:194)
Ok, fine, the network cable was purposely unplugged. I plug it back, and every 10s, it still have the same exception : i cannot connect to the database once it has fumbled ... I can still connect with sqltools, so the db is up. If I stop the application and restart it, it works, so the url, the user and the pass are ok. Any idea ? Thanks
Fabien, Can you post the code segment you use to try the connection? It sounds like you might be repeatedly trying the same connection that doesn't work. The alternative is to close the connection and get a new one or use connection pooling.
As Jeanne says, close the connection (con.close()) when you catch the exception. That should solve the problem. Otherwise your subsequent calls to getConnection() are probably just picking up the broken one.
You might need a little more than 10 seconds for it to recover and connect happily.