We''ve implemented the ConnectionPool code from Marty Halls book 
http://www.coreservlets.com. In our production environment we connect to Oracle 
through a Firewall. So the pooled connections are
actually being proxied.

If the connection is IDLE for an unspecific time, the firewall closes the connection 
to Oracle, but the STATE of the Connection in the Pool is OPEN. So when we go to do a 
createStatement() the result
is SQLException write socket error rest by Peer.

Anyway....I'd like to add this code to the ConnectionPool.java class and on the 
createStatement() do a try. If encountering SQLException I would call the method below 
passing in the orphaned
connection.

This code can only be tested in the firewalled environment, so I wanted to see if 
anyone had any comments

/**
        restoreConnection method is used when the firewall
        closes an IDLE connection
*/
  public synchronized Connection restoreConnection(Connection conn)
  throws SQLException {

         try {
                conn.close();   //free any resources still lying around
         } catch (SQLException e){
         } finally {
                busyConnections.removeElement(conn); //vector of in-use connections
                conn = null; // goodbye - you are the weakest link
         }

    return getConnection();   // creates a connection in the background adding it to 
busyConnections vector
  }

Thanks

Bill

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to