You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Yin Tse <yi...@valicert.com> on 2001/02/02 01:27:54 UTC
RE: Tomcat/firewall/oracle timeout problem
Hi all,
I'm having a problem with a jdbc connection object between tomcat and an
oracle server. The 2 machines are separated by a firewall which was
configured to allow access to the oracle server from the tomcat server only.
The problem starts when the timeout period(which can be set to an arbitray
time period) of idle time runs out. It sends a timeout signal and that
breaks the jdbc connection. The application then freezes any attempts to log
in/manage your account or do activities which need database connection. But
tomcat still works fine, any servlets which do not need database connection
works fine.
I added some code to check if my connection object is null and to create a
new one if it is so. That didn't solve the problem which means that the
connection object is not killed, but its content (like db driver, conn url ,
login & password etc..)is somehow scrambled. My question is how can I manage
those jdbc connection objects and how to figure out when something went
wrong with the connection object ? Thanks all.
Re: Tomcat/firewall/oracle timeout problem
Posted by Jason Pell <Ja...@dssonline.com.au>.
Instead of checking if the Connection is null, why not try a simple test of
whether
the connection is still active.
Try a query: "select USER from dual" for instance, if an exception is thrown
this
indicates the connection is invalid and needs to be reset.
You might also like to take a look at the connection pooling software from
javaexchange, called DbConnectionBroker, which can take care of and reinitialise
expired/invalid connections.
Cheers
Jason
Yin Tse wrote:
> Hi all,
> I'm having a problem with a jdbc connection object between tomcat and an
> oracle server. The 2 machines are separated by a firewall which was
> configured to allow access to the oracle server from the tomcat server only.
> The problem starts when the timeout period(which can be set to an arbitray
> time period) of idle time runs out. It sends a timeout signal and that
> breaks the jdbc connection. The application then freezes any attempts to log
> in/manage your account or do activities which need database connection. But
> tomcat still works fine, any servlets which do not need database connection
> works fine.
> I added some code to check if my connection object is null and to create a
> new one if it is so. That didn't solve the problem which means that the
> connection object is not killed, but its content (like db driver, conn url ,
> login & password etc..)is somehow scrambled. My question is how can I manage
> those jdbc connection objects and how to figure out when something went
> wrong with the connection object ? Thanks all.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, email: tomcat-user-help@jakarta.apache.org
--
Jason Pell
Senior Analyst/Programmer - Web Developer
Deakin Software Services Pty Ltd
12 Gheringhap St, Geelong Victoria 3220 Australia
Phone: 03 5227 8858 International: +61 3 5227 8858
Fax: 03 5227 8907 International: +61 3 5227 8907
E-mail Jason.Pell@dssonline.com.au
http://www.dssonline.com.au
Customer Support Hotline: 1800 620 497
"Callista - the brightest solution in university management"
---------------------------------------------------------------
Important Notice: The contents of this email transmission,
including attachments, may be privileged and confidential.
Any unauthorised use of the contents is expressly prohibited.
If you have received this transmission in error, please advise
the sender by return email or telephone immediately and
destroy all versions.
---------------------------------------------------------------
RE: Tomcat/firewall/oracle timeout problem
Posted by Kevin Sangeelee <ke...@susa.net>.
You could execute some simple SQL and catch any exceptions to test the
connection and re-establish it if necessary. There's also an isClosed()
method of Connection which the docs say will test to see if a connection
is closed.
Theres some stuff in javax.sql (jdbc extensions) that provide
ConnectionEventListener to notify you of connection object changes. I
don't know anything more about this, but it might be useful.
On Thu, 1 Feb 2001, Yin Tse wrote:
> Hi all,
> I'm having a problem with a jdbc connection object between tomcat and an
> oracle server. The 2 machines are separated by a firewall which was
> configured to allow access to the oracle server from the tomcat server only.
> The problem starts when the timeout period(which can be set to an arbitray
> time period) of idle time runs out. It sends a timeout signal and that
> breaks the jdbc connection. The application then freezes any attempts to log
> in/manage your account or do activities which need database connection. But
> tomcat still works fine, any servlets which do not need database connection
> works fine.
> I added some code to check if my connection object is null and to create a
> new one if it is so. That didn't solve the problem which means that the
> connection object is not killed, but its content (like db driver, conn url ,
> login & password etc..)is somehow scrambled. My question is how can I manage
> those jdbc connection objects and how to figure out when something went
> wrong with the connection object ? Thanks all.