You haven't closed your resultset...

Harm.




"Mike Youngstrom" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
10/09/2003 06:37 PM
Please respond to
[EMAIL PROTECTED]


To
<[EMAIL PROTECTED]>
cc

Subject
[JBoss-user] Quick JDBC question.






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

�+w�zf��+,��좷�o$���F���i���+jd�����zw���-��ޯ�4�C�zt���>�#y�lI筅�^��^�!j����
D����u�޶׫���Ǭ
X���zm�����y�+��޷�.��+���I�,�ǫ����x%��I�,�ǫ�+-��.�ǟ����a��l��b��,���y�+��޷�b��?�+-�w��6�ˬz

Reply via email to