Could not find prepared statement with handle n

Posted by Community Admin on 03-Aug-2018 19:43

Could not find prepared statement with handle n

All Replies

Posted by Community Admin on 08-Apr-2011 00:00

Hi - Our live site (so yes - this is urgent!!) running Sitefinity build 1098 is intermittently getting this error when multiple users are editing pages simultaneously:

Telerik.OpenAccess.RT.sql.SQLException: Could not find prepared statement with handle n

We are making extensive use of the Sitefinity API for site customizations.  I have read 3 interesting posts related to this error:

1. there is a problem with the SQL Server driver (www.telerik.com/.../prepared-statement-not-getting-created.aspx)
2. the max connections setting in SQL Server must be increased (www.sqlservercentral.com/.../Topic468215-145-1.aspx
3. MS patch:  support.microsoft.com/.../913765

Exception:

[SQLException: Could not find prepared statement with handle 27.]
   Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeQuery() +573
   OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeQuery() +85
   OpenAccessRuntime.Relational.fetch.FetchResultImp.execute() +86

[DataStoreException: Error executing query: Telerik.OpenAccess.RT.sql.SQLException: Could not find prepared statement with handle 27.
   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeQuery()
   at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeQuery()
   at OpenAccessRuntime.Relational.fetch.FetchResultImp.execute()
SQL:
SELECT a.[id] AS COL1, a.[approval_workflow_state_] AS COL2, a.[description_] AS COL3, a.[title_] AS COL4, a.[url_name_] AS COL5, a.[app_name] AS COL6, a.[id2] AS COL7, a.[can_inherit_permissions] AS COL8, a.[date_created] AS COL9, a.[inherits_permissions] AS COL10, a.[last_modified] AS COL11, a.[nme] AS COL12, a.[ordinal] AS COL13, a.[ownr] AS COL14, a.[content_id] AS COL15, a.[parent_id] AS COL16, a.[render_as_link] AS COL17, a.[root_id] AS COL18, a.[show_in_navigation] AS COL19, a.[voa_version] AS COL20 FROM [sf_page_node] a JOIN [sf_page_node] AS b ON (a.[root_id] = b.[id]) WHERE a.[app_name] = ?               AND a.[root_id] IS NOT NULL AND b.[id] = ?                Telerik.OpenAccess.RT.sql.SQLException: Could not find prepared statement with handle 27.
   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeQuery()
   at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeQuery()
   at OpenAccessRuntime.Relational.fetch.FetchResultImp.execute()]
   Telerik.OpenAccess.RT.ExceptionWrapper.Throw() +13
   OpenAccessRuntime.storagemanager.logging.LoggingStorageManager.fetchNextQueryResult(ApplicationContext context, RunningQuery runningQuery, Int32 skipAmount) +546
   OpenAccessRuntime.DataObjects.ForwardQueryResult.get_Item(Int32 indexParam) +364
   Telerik.OpenAccess.RT.ListEnumerator.setCurrent(Int32 _pos) +58
   Telerik.OpenAccess.RT.ListEnumerator.Move(Int32 relative) +107
   System.Linq.WhereEnumerableIterator`1.MoveNext() +196
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +488
   System.Linq.<GetEnumerator>d__0.MoveNext() +146
   System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source) +299
   System.Linq.Queryable.SingleOrDefault(IQueryable`1 source) +383

Posted by Community Admin on 10-Apr-2011 00:00

My live Sitefinity 4.0 site is essentially down because of this problem. 

Any ideas?  Shall I send source code / config files?  Shall I instead open a support ticket?

Posted by Community Admin on 11-Apr-2011 00:00

Hi Valerie,

Can you give us more information about the issue - when did it started appearing? Do you know of any server restrictions which may not allow multiple user editing pages in the backend ? Have you considered upgrading to SP1 ? Any additional information about your current website would be appreciated in order to solve the problem faster.

Greetings,
Victor Velev
the Telerik team


Posted by Community Admin on 21-Dec-2011 00:00

We're also seeing this error intermittently using Sitefinity 4.0. Was there ever a resolution to this issue?

FYI: We have not upgraded since because of compatibility concerns. If we can resolve this without upgrading that would be ideal. 

Posted by Community Admin on 26-Dec-2011 00:00

Hi Ben and Valerie,

What version of SQL Server are you using? This isn't a common problem with Sitefinity but more likely a SQL Server issue. As you correctly pointed out there is a KB article from Microsoft:

http://support.microsoft.com/kb/913765 

Have you try that?

Kind regards,
Lubomir Velkov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 03-Jan-2012 00:00

Thanks for the response Lubomir. We are probably going to try the MS patch you mentioned but we haven't scheduled the patch yet. We're using SQL Server 2008 R2. 

Posted by Community Admin on 03-Jan-2012 00:00

After attempting to apply the patch I realized the MS patch and thread are for the .Net 2.0 framework. Our Sitefinity 4.0 installation is on the .Net 4.0 framework and the patch does not apply and will not install on the machine. 

I did some more googling and found this: 
http://connect.microsoft.com/VisualStudio/feedback/details/680584/ado-net-cannot-reuse-sqlcommand-after-prepare-and-execute-on-another-sqlconnection#details 

If you expand the "Details" icon you can see a pretty good example of C# code that causes the failure. I assume there is some code very similar to this in the sitefinity 4.0 source code?

Posted by Community Admin on 09-Jan-2012 00:00

Hello,

We haven't see this issue and it would be better if you upgrade to the latest release Sitefinity 4.4 and see if the problem is going to disappear. If not, we will need a sample project and steps to replicate this issue locally and try to figure out what the problem is.

Regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 09-Jan-2012 00:00

Thanks Ivan. We'll see if we can upgrade. 

Posted by Community Admin on 20-Jun-2012 00:00

I am hitting the same problem.  I am running an instance of Sitefinity 3.7 (4.0 Framework) with the Mallsoft Ecommerce plug-in.  It is the Mallsoft piece that is causing the error.  Upgrading is not an option at this time.  Any options?

Posted by Community Admin on 20-Jun-2012 00:00

** duplicate post **

This thread is closed