Angus, You can call Conection.isClosed(), but the documentation suggests that this is not a reliable method of telling that it is _definitely_ closed. However, if it does return true, you know that you should reconnect before attempting a call with the connection.
Andy > -----Original Message----- > From: Angus Mezick [mailto:[EMAIL PROTECTED] > Sent: 09 July 2003 15:53 > To: Tomcat Users List > Subject: [OFFTOPIC??] RE: dbcp connection and database restart > > > Is there a better way of doing this? Even if I 'select 1 from TABLE' I > don't like the fact that there is an extra DB communication for every > connection I get from the pool. I don't know if there are alternatives > to this in DBCP but are there any other ways to ask if a connection in a > pool is still valid besides just running a query and seeing if it fails? > (in general, NOT in dbcp) > --Angus > > > -----Original Message----- > > From: Raible, Matt [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, July 09, 2003 8:49 AM > > To: 'Tomcat Users List' > > Subject: RE: dbcp connection and database restart > > > > > > Try adding a validation query, for example: > > > > <parameter> > > <name>validationQuery</name> > > <value>SELECT * FROM USER_TABLE</value> > > </parameter> > > > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, July 09, 2003 6:46 AM > > To: [EMAIL PROTECTED] > > Subject: dbcp connection and database restart > > > > > > > > I've configured my jdbc datasource connection pool(using dbcp) in > > Tomcat > > 4.1.18 > > server.xml file. > > > > here is an extract of it. > > > > <ResourceParams name="jdbc/intranetMail"> > > <parameter><name>username</name><value>XXXXXXX</value></parameter> > > <parameter><name>password</name><value>XXXXXXX</value></parameter> > > <parameter><name>driverClassName</name> > > > > <value>com.sybase.jdbc2.jdbc.SybDriver</value></parameter> > > <parameter><name>url</name> > > > > <value>jdbc:sybase:Tds:s198000SGD1:5000/intranet_mail</value>< > > /parameter > > > > > > > </ResourceParams> > > > > Everything works fine. But > > when our database server is restarted, I have to restart Tomcat too > > in order to aquire connections from my defined pool. > > > > I wonder if there is a manner to avoid restarting Tomcat when > > the database server is restarted. > > > > I have added the parameters below to my pool config. > > > > <parameter> > > <name>removeAbandoned</name> > > <value>true</value> > > </parameter> > > <parameter> > > <name>removeAbandonedTimeout</name> > > <value>60</value> > > </parameter> > > > > I recognize ,I've added that quite blindly. > > Can someone confirm me if this is a cure to my problem ? > > > > any suggestion is greatly appreciated. > > > > > > Meissa > > > > L'integrite de ce message n'etant pas assuree sur internet, Natexis > > Banques Populaires ne peut etre tenu responsable de > > son contenu. Toute utilisation ou diffusion non autorisee est > > interdite. Si vous n'etes pas destinataire de ce message, merci de le > > detruire et d'avertir l'expediteur. > > > > The integrity of this message cannot be guaranteed > > on the Internet. Natexis Banques Populaires can not therefore be > > considered responsible for the contents.Any unauthorized use or > > dissemination is prohibited. > > If you are not the intended recipient of this message, then please > > delete it and > > notify the sender. > > > > --------------------------------------------------------------------- > > 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]