I’m fairly new to JDBC development and JBoss.  I have the following code in a stateless session bean.

 

            try {

                  boolean exists;

                  prepStmt = conn.prepareStatement(USERNAME_EXISTS);

                  prepStmt.setString(1, username);

                  ResultSet result = prepStmt.executeQuery();

                  exists = result.next();

                  result.close();

                  return exists;

            } catch (EJBException e) {

                  log.error("Error checking if username exists: ", e);

                  throw new EJBException(e);

            } finally {

                  try {

                        prepStmt.close();

                  } catch (Exception e) {/* Do Nothing */}

                  try {

                        conn.close();

                  } catch (Exception e) {/* Do Nothing */}

 

            }

 

Every time I execute the above method I get the following log entry:

 

WARN  [WrappedConnection] Closing a statement you left open, please do your own housekeeping

 

Any idea what I’m doing to warrant that warning?  When I step through the code with a debugger prepStmt.close() is executed with no exception and when conn.close() is executed that warning pops up.  prepStmt is the only statement I’m creating with that connection.  Anyone have any ideas?

 

Mike

Reply via email to