Bhavesh Kumar wrote:

I am using Apache Tomcat/4.1.27.

Problem: when datbase restarts connection is not established.

Connection pool is done by Tomcat using DBCP.


[...]


Is there any tag which takes care that application is automatically
connected whenever datbase goes up.

It would be really  great if there is some feedback on this problem.

I know for My SQL we can append autoRecconnect=true in database url ..
Is there any equivalent for jdbc:oracle:thin driver like oracle.jdbc.driver.OracleDriver


Going through Tomcat DBCP configuration somewhere it is mention use validationQuery as a parameter in context tag.
But I am not really sure....because it is not clear what is the purpose of this parameter.


Any ideas ? ?



Hi,

we do not use Tomcat DBCP but the OracleConnectionCacheImpl.
Because we do db backup at night the pool loose all conections, the morning when the first user
tries to log it get first invalidated connection that are cleaned properly by the pool. What we have
is a java code like this :


conn = (Connection) session.getAttribute(connectionIdentifier);
while (conn == null && attempt < MAX_CONNECTION_ATTEMPT) {
try {
attempt++;
conn = ConnectionManager.getInstance().getConnection("Some info");
}


Our ConnectionManager puts some information in V$SESSION MODULE_INFO and
CLIENT_INFO rows, so for each Connection demand we execute a Statement on that
Connection and raise an exception if it is one of the lost Connection and we return a null
Connection.


Each morning I get the foolowing exception (Sorry it is in french):
09:10:40 LVL: WARN : class fr.cognitis.brle.util.connection.ConnectionManager.getConnection() : ocacheimpl.getConnection(); e levé une SQLException: Connexion interrompue
09:10:40 LVL: WARN : Erreur en tentant de fermer ocacheimpl lors de sa réinitialisation: Exception d'E/S: Broken pipe


Maybe the solution is to test each Connection you receive from the pool like this:
conn.prepareCall("{call dbms_application_info.set_module(module_name => 'my webapps', action_name => 'action')}");
rs = cs.executeQuery();
If exception is raised you must ask another Connection to the pool until it returns a good one.
Anyway it is a good idea to use "dbms_application_info" with oracle.


Hope it helps.


Thank you, Bhavesh Kumar




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to