That worked for me. - Thanks
Daniel John Debrunner wrote:
[EMAIL PROTECTED] wrote:
Hi,
I am trying to get runtimestatistics for a PreparedStatement on a jdbc
connection. Looks like the RUNTIMESTATISTICS() function completely
ignores PreparedStatement(s).
Here is the code snippet:
conn = DBManager.getConnection();
Statement stmt = conn.createStatement();
stmt.executeUpdate("CALL
SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
stmt.executeUpdate("CALL
SYSCS_UTIL.SYSCS_SET_STATISTICS_TIMING(1)");
PreparedStatement pstmt1 = conn.prepareStatement("SELECT
user_name FROM users");
rs = pstmt1.executeQuery();
while (rs.next())
System.out.println(rs.getString(1));
ADD -- rs.close();
rs = stmt.executeQuery("VALUES
SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
if (rs.next())
System.out.println(rs.getString(1));
When I executed the query as a regular Statement, it worked fine.
Any ideas ?
I think you need to close the result set for the select statement.
See above.
Dan.