Hi Ateesh -
I am looking into this. I have gotten the same results as you and will investigating how to obtain runtime statistics output form a JDCB program.

Stan    [EOM]

[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));

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 ?



Reply via email to