#10 Query is only recorded on statement.close

open
None
5
2007-05-03
2007-04-30
David Newcomb
No

Only closing the Statement explicitly will trigger the query to be included into the statistics.

eg
Connection conn = DBCluster.getInitialConnection () ;
Statement stmt = conn.createStatement () ;
stmt.executeQuery ("SELECT * FROM properties");
stmt.executeQuery ("SELECT * FROM formats");
conn.close () ;

This will record nothing!

From the Java specification for Statement:

"...All execution methods in the Statement interface implicitly close a statement's current ResultSet object if an open one exists."

i.e. you can run SQL queries consecutively on 1 statement. Once statement.close is called the statement is useless.

Discussion

  • David Newcomb
    David Newcomb
    2007-04-30

    Logged In: YES
    user_id=762346
    Originator: YES

    A bit more investigation has revealed some worrying points.
    conn.close forwards the close down to the 'real' driver. The real driver closes all the statements on that connection. The elvyx-statement.close is never called, so the statistics for that statement are never submitted.
    The elvyx-connection wrapper must track the statements which are created from that connection and intercept the close. When close is called it must individually close each statement before closing the actual connection or the queries won't be logged.

     
  • Logged In: YES
    user_id=1502109
    Originator: NO

    Yes, definitely this is an issue. I have to think about the best way to solve it. Any comment, ideas will be appreciated.

     
    • assigned_to: nobody --> perdom