Hibernate version: 2.1.6
Name and version of the database you are using: Oracle 8 (with Oracle 9 JDBC drivers, for less-buggy CLOB support)
Hi folks,
A customer is reporting that one of our periodic tasks is leaking cursors. Of course, we don't observe the same problem with MySQL. Here's the code that appears to be responsible:
Code:
Session session = null;
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
session = getSession();
conn = session.connection();
ps = conn.prepareStatement("DELETE FROM table WHERE field < ?");
ps.setLong(1, value);
int num = ps.executeUpdate();
if (num > 0) logger.fine("Did stuff " + num + " times");
conn.commit();
conn = null;
} finally {
if (conn != null) try {
conn.rollback();
} finally {
if (rs != null) try {
rs.close();
} finally {
try {
if (ps != null) ps.close();
} finally {
if (session != null) session.close();
}
}
}
}
I'm using C3P0 0.8.5pre4 and I've tried turning off its PreparedStatement cache, to no effect. Am I doing something obviously wrong here?
Thanks!