Recently on my production system which runs java application following error appeared:
Error: 8179 Could not find prepared statement with handle x
where the x is some random handler number. I have been browsing google since Sunday and did not find any satisfactory explanation of this problem. My company applications did not change, nor may database server (SS2000 SP4). Most of programmers complain that the source of the problem is simply database, which I do not agree obviously, I ready that it could be problem caused by the driver (jTDS) or specific coding of prepared statements. Do you have any suggestion how to avoid this error, I need it urgently because this problems happens on my production system?
Any help appreciated.
It seems that most of you have never met this error in administrative work, so I would like to close this topic and provide my insights. After deeper analysis, read it: browsed almost all google in this topic;-) me and my support colleague came up with following conclusion:
A query plan for prepared statement (PS) was removed from SQL Server plan cache (which is absolutely normal) and jTDS driver was unable to find it throwing this error message, probably jTDS driver was not able to recompile the statement. The safest solution to avoid this problem again and allow application to cooperate with database would be recoding part of application code responsible for PS in a way that application handles this error message by recompiling (driver calls again sp_prepare procedure) SQL statement.
I hope my findings help a bit someone who stumble upon this error in his/her DBA work.
answered Jun 07 '11 at 06:30 AM
Other Google results seem to suggest issues at the data layer. I know you have said that there have been no application changes, or database changes, but could there have been any application server (or whatever is being used as the client) changes: OS updates, patches etc....
answered Jun 06 '11 at 01:28 AM
Kev Riley ♦♦