I have put together a timeout function in our logic which is intended to cancel a statement that is blocked for a given amount of time. I have based this logic around using the execute, executeUpdate and executeQuery methods found in a PreparedStatement object. In the process, I have discovered some curious behavior regarding PreparedStatement objects.
Scenario: I have updated a single row in a database table using dbisql and am going to have my program do a select against that same row.
I am running against SQL Anywere 12.0.1 build 3967 on Windows.
Using jConnect 7 and then using executeQuery, the program blocks at the executeQuery method until I either rollback or commit my change in dbisql; however, under iAnywhere, the same logic returns from the executeQuery method and ends up blocking on the ResultSet.next method. Now the real strange thing to me is if I use a CallableStatement with iAnywhere and call a procedure that returns a result set and is going to access the same row as the PreparedStatement, the CallableStatement.executeQuery blocks and does not return until I either do a rollback or commit.
Can someone help me out in understanding this?
Also, as I stated, I have come up with my own timeout logic to keep from blocking forever on a database statement. Is there something already built in that I may have missed that would work better? Keep in mind, I may only want a timeout on certain connections, not all of them.
Thanks