Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Could not find prepared statement with handle xx Expand / Collapse
Author
Message
Posted Wednesday, March 12, 2008 9:29 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, March 25, 2008 4:22 AM
Points: 3, Visits: 11
Hi

I am having a randomly recurring problem where I get the error message:

"Could not find prepared statement with handle xx"

where xx is a number.

The problem occurs randomly and can be solved just by forcing a dummy change in my SQL (such as a new line break) and re-running it, with no SQL changes.

Does anyone have any ideas on what could cause this?

Thanks!
Post #468215
Posted Thursday, March 13, 2008 9:18 AM
UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Friday, April 5, 2013 4:43 PM
Points: 1,473, Visits: 1,314
Is it the full error message?
Do you use JAVA?
Does your server have a limit in concurrent users?
The following link may help a little bit.
http://developer.atlassian.com/jira/browse/SQL-30
Post #468810
Posted Friday, March 14, 2008 8:32 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, March 25, 2008 4:22 AM
Points: 3, Visits: 11
It a Java app, although that is hidden from my interface, where I am writing just the SQL and submitting it. The full message I get is:

sql: java.sql.SQLException: Could not find prepared statement with handle 1.

...but I don't get the java stack dump (maybe its hidden from my application).

Not sure about the concurrent server user limit - it should be high.

What is actually happening on SQL Server when I use (or at least the Java ODBC driver uses) prepared statements?
I would guess that on first execution, the statement is prepared and executed. On subsequent executions, a handle is used to point to the prepared statement, and therefore only the execution actually takes place (instead of prepare & execute). Could anybody confirm that is how it should work?

Thanks!
Post #469427
Posted Friday, March 14, 2008 9:05 AM
UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Friday, April 5, 2013 4:43 PM
Points: 1,473, Visits: 1,314
You can cooperate with your DBA to check the version of your SQL Server, and its setting of max connections.
Post #469464
Posted Friday, March 14, 2008 10:21 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, March 25, 2008 4:22 AM
Points: 3, Visits: 11
We have SQL Server 2000 and maxActive is set to 20 for our connection.
Post #469527
Posted Monday, November 30, 2009 9:00 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, July 18, 2014 4:25 AM
Points: 1, Visits: 10
Check out microsoft ADO.NET 2.0 hotfix in this link, it appears to be related to your problem:
http://support.microsoft.com/kb/913765
Post #826284
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse