Martin Gainty ha scritto:

javax.sql.DataSource
dataSource ; java.sql.Connection connection;
java.sql.Statement statement;
java.sqlResultset resultSet;
code..

try{ connection = dataSource.getConnection();
     statement = connection.prepareStatement("SELECT FU FROM BAR");
     resultSet = statement.executeQuery();
}
catch (SQLException sqlEx) {
  try
  {
    resultset.close();
    statement.close();
    connection.close();
} catch(java.sql.SQLException excp)
  {
    log.debug("A SQLException has been produced another Exception on 
resultset/statement/connection was produced where the message="=excp.getMessage());
  }
}
catch (Exception ex) {
  try
  {
    resultset.close();
    statement.close();
    connection.close();
} catch(java.sql.SQLException excp) {
    log.debug("A General Exception has been produced another SQLException on
         resultset/statement/connection was produced where the
         message="=excp.getMessage());
    }
} catch(java.sql.SQLException excp)
  {
    log.debug("SQLException on resultset/statement/connection close 
message="=excp.getMessage());
  }
} finally
{
  try
  {
    resultset.close();
    statement.close();
    connection.close();
} catch(java.sql.SQLException excp)
  {
    log.debug("Exception on resultset/statement/connection close 
message="=excp.getMessage());
  }
} //end finally..


I have
  resultset.close();
  statement.close();
  connection.close();
in my code.

and
  connection = dataSource.getConnection();
seems very close to my
  ambiente = (Context) new InitialContext().lookup("java:comp/env");
  pool = (DataSource) ambiente.lookup("jdbc/myApp);
  Connection conn = pool.getConnection();
there are a lot of debug information in my code and seems that nothing is going wrong (no exceptions).

but... if you post that it means that I am doing something wrong.

Edoardo



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to