You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Christian J. Dechery" <ch...@finep.gov.br> on 2002/06/11 20:40:58 UTC

getting exception when trying to close connection

I know my implementation isn't the best there is... take a look at this code:
 
 protected void finalize() {
  try {
   if( con!=null && !con.isClosed() && con.getAutoCommit() ) {
    con.close();
   }
  }
  catch(SQLException sqle) {
   System.out.println("["+this.getClass().getName()+"] Não foi possível fechar a conexão. "+sqle.toString()+"\n");
//   sqle.printStackTrace();
  }
 }

that's what I use to TRY to close all connections... this code is in my DAO class. Sometimes I have up to four DAO classes instantiated in a single JSP... I debugged it... at least one always fails to close giving me this exception: "I/O error: socket closed"
 
what does that mean? what socket? And why did all the other connections closed and this didn't?
 
.:| Christian J. Dechery
.:| FINEP - Depto. de Sistemas
.:| christian@finep.gov.br
.:| (21) 2555-0332


RE: getting exception when trying to close connection

Posted by Zachary Kuhn <zk...@pricegrabber.com>.
It would be halpful to see the declaration of con, and the type of driver
you are using


-----Original Message-----
From: Christian J. Dechery [mailto:christian@finep.gov.br]
Sent: Tuesday, June 11, 2002 11:41 AM
To: tomcat-user@jakarta.apache.org
Subject: getting exception when trying to close connection


I know my implementation isn't the best there is... take a look at this
code:

 protected void finalize() {
  try {
   if( con!=null && !con.isClosed() && con.getAutoCommit() ) {
    con.close();
   }
  }
  catch(SQLException sqle) {
   System.out.println("["+this.getClass().getName()+"] Não foi possível
fechar a conexão. "+sqle.toString()+"\n");
//   sqle.printStackTrace();
  }
 }

that's what I use to TRY to close all connections... this code is in my DAO
class. Sometimes I have up to four DAO classes instantiated in a single
JSP... I debugged it... at least one always fails to close giving me this
exception: "I/O error: socket closed"

what does that mean? what socket? And why did all the other connections
closed and this didn't?

.:| Christian J. Dechery
.:| FINEP - Depto. de Sistemas
.:| christian@finep.gov.br
.:| (21) 2555-0332



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>