We are running Sybase Adaptive Server 220.127.116.11 with JRun 3.1 (a j2ee application server).
About once a day JRun emits the following error:
"java.sql.SQLException: [JRun][Sybase JDBC Driver][Sybase]The cursor '(Unknown name)' can not be used as it could not be found. It is
possible that either it was not declared or it is not available in the current context."
Once this error has occured once, it occurs more frequenly, although *some* database access is still possible.
According to the Sybase manual, the error explanation is:
"Adaptive Server could not perform the requested action. Check your command for missing or incorrect database objects, variable names, and/or input data."
This is useless to us. We are pretty sure that our SQL-calls are correct as they are working until the error suddenly occurs.
We have discovered that time-consuming (i.e. big) SQL-calls that causes a timeout actually leads to JRun emitting the error above. However, we cannot simply increase the timeout as that causes clients to wait for too long (because of locks). Our timeout is currently set to 60 seconds.
We have about a zillion SQL-calls distributed in all our code so finding the time-consuming SQL-calls is quite difficult...
What to do?
We are considering logging all SQL-calls, with a timestamp and a time-to-complete (or timeout), but we want to do this at the Sybase side rather than at dozens of clients.
Is such SQL-call logging possible? Basically, we want something like this:
<sqlcall>, <call-date>, <completion-time>
"select * from MyTable", 2003-09-03 12:28:04, 190 milliseconds