I'm not closing the ResultSet?  I thought I was....granted I'm doing it in a strange 
place.

I changed the code to look like how Rod described and I'm still getting the warning.

Is anyone else experiencing anything like this?  Should I post a bug?

Mike

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Friday, October 10, 2003 3:03 AM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Quick JDBC question.

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

NHYX銲uw+m>xZ zʾMӥ x 'z{B5z Ǿ')rH趟q
z ײ$f뮖)+$X뮶˺~zw۳ q
z  X)



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to