x

Error: 8179 Could not find prepared statement with handle

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.
more ▼

asked Jun 06, 2011 at 01:15 AM in Default

Bartolo gravatar image

Bartolo
101 4 4 5

(comments are locked)
10|1200 characters needed characters left

3 answers: sort voted first

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.
more ▼

answered Jun 07, 2011 at 06:30 AM

Bartolo gravatar image

Bartolo
101 4 4 5

(comments are locked)
10|1200 characters needed characters left
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....
more ▼

answered Jun 06, 2011 at 01:28 AM

Kev Riley gravatar image

Kev Riley ♦♦
53k 47 49 76

At the begining I thought so, becauses one applications server was migrated to Win2008 but this error also appeared on old not migrated server with not changed OS (Win2003).
Jun 06, 2011 at 01:54 AM Bartolo
no automatic windows updates?
Jun 06, 2011 at 01:55 AM Kev Riley ♦♦
It should not run atuomatically, but I have to verify. Thanks!
Jun 06, 2011 at 01:58 AM Bartolo
As I thought, no OS updates were done.
Jun 06, 2011 at 02:33 AM Bartolo
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x371
x41

asked: Jun 06, 2011 at 01:15 AM

Seen: 5033 times

Last Updated: Jun 06, 2011 at 01:19 AM