Okay, I am assuming the JAVA application is one that you have the source to and are able to build. If the application is a third party app or one that you cannot build, then disregard the rest of this answer. I am also assuming that you are running on Windows. If so, then here is a brute force approach:
1) Temporarily change the application to use the iAnywhere JDBC driver not the SQL Anywhere JDBC driver.
2) Temporarily modify your application so that as soon as it detects the resource governor error, it immediately closes the single connection and exits.
3) Before starting your application, turn on ODBC tracing.
4) Run your application until it hits the resource governor error and exits. Note I realize this step could take a very long time (especially with ODBC tracing turned on).
Once the app exits, turn off ODBC tracing and have a look at the trace log. Look for the resource governor error. At the time the application issues the connection close, the iAnywhere JDBC driver will explicitly call SQLFreeStmt(SQL_CLOSE) for every statement that is still open. Hence, you should see a bunch of SQLFreeStmt calls following the resource governor error in the ODBC trace. You can then use the statement handle within each SQLFreeStmt(SQL_CLOSE) along with the portion of the ODBC trace prior to the resource governor error to figure out which statements are still open. If you used Connection.prepareStatement() then there should be a SQLPrepareW call in the ODBC trace with the particular statement handle; and if you used Connection.createStatement() then there should be a SQLExecDirectW call with the particular statement handle. For each SQLPrepareW and SQLExecDirectW call that you identify as belonging to a statement handle that was still open at the time the connection was closed, look at the "WCHAR" argument to see what the SQL statement associated with the statement is.
As I said before, the above is an extremely tedious and brute force method but given that you have received no other suggestions, this might be your only choice.
answered
07 Sep '10, 17:13
Karim Khamis
5.6k●5●38●70
accept rate:
40%