-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------


>On Tue, 14 Sep 1999, Craig R. McClanahan wrote:
>CRM| that the connection at the "bottom" of the stack was used pretty rarely.  It
>CRM| seems that Oracle SQL*Net will sometimes disconnect a long-lived connection
>CRM| that hasn't been accessed for a significant amount of time, which caused a
>CRM| problem for the next user that I eventually allocated that connection to.
>
>So I've written a wrapper around a (Oracle-)Connection which can be asked
>for Statements etc. Before each action, it makes a quick check if the
>connection is still alive and makes a reconnect if not.

Just as a general FYI, the problem is probably rooted in the fact
that there are Oracle session configuration parameters for things
like maximum allowable idle time.  I've also received problem reports
on one of my servlets that makes me suspect simple liveness testing of
the connection may not be sufficient (most likely due to getting an ok
result on the test just before the max idle time was hit by the database
and before the connection was used by the servlet).

Currently I age the connections and junk anything older than a pre-set 
age (you could try and keep this in sync with the session idletime 
settings in the Oracle database, but there are some catch-22s to work
around).  I also deliberately don't do a per-statement test of the
connection.  That works best in circumstances where each statement
constitutes one or more completed transactions, but never just a 
portion of an uncompleted transaction.  It is also a better model for
code that uses prepared statements (assuming a JDK version without
so many bugs that prepared statements become infeasible).  I still test 
the connection by doing something like "select 1+1 from dual", just in 
case previous sessions mucked up the state of the connection.







====================================================
= Reid M. Pinchback                                =
= I/T Delivery, MIT                                =
=                                                  =
= Email:   [EMAIL PROTECTED]                          =
= URL:     http://mit.edu/reidmp/www/home.html     =
=                                                  =
= Respect your own privacy; boycott Pentium III    =
====================================================



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to