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 |
- RE: [JBoss-user] Quick JDBC question. Mike Youngstrom
- RE: [JBoss-user] Quick JDBC question. Mike Youngstrom
- Re: [JBoss-user] Quick JDBC question. harm
- RE: [JBoss-user] Quick JDBC question. Mike Youngstrom
- [JBoss-user] Update: XDoclet changes for JBoss Jon Barnett
- RE: [JBoss-user] Quick JDBC question. Rod Macpherson
- RE: [JBoss-user] Quick JDBC question. Mike Youngstrom
- RE: [JBoss-user] Quick JDBC question. Rod Macpherson