db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ateesh_Ve...@rapid7.com
Subject A question regarding RuntimeStatistics()
Date Wed, 10 May 2006 20:37:58 GMT
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));

         rs = stmt.executeQuery("VALUES 
SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");

         if (rs.next())
           System.out.println(rs.getString(1));


Here is the output I get:

Statement Name:
        null
Statement Text:
        CALL SYSCS_UTIL.SYSCS_SET_STATISTICS_TIMING(1)
Parse Time: 0
Bind Time: 0
Optimize Time: 0
Generate Time: 0
Compile Time: 0
Execute Time: 0
Begin Compilation Timestamp : null
End Compilation Timestamp : null
Begin Execution Timestamp : null
End Execution Timestamp : null
Statement Execution Plan Text:
null)

When I executed the query as a regular Statement, it worked fine. 

Any ideas ? 
Mime
View raw message