+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Could not find prepared statement with handle n

Could not find prepared statement with handle n

11 posts, 0 answered
  1. Valerie
    Valerie avatar
    19 posts
    Registered:
    24 Mar 2010
    08 Apr 2011
    Link to this post
    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 (http://www.telerik.com/community/forums/orm/development/prepared-statement-not-getting-created.aspx)
    2. the max connections setting in SQL Server must be increased (http://www.sqlservercentral.com/Forums/Topic468215-145-1.aspx#bm826284)
    3. MS patch:  http://support.microsoft.com/kb/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
  2. Valerie
    Valerie avatar
    19 posts
    Registered:
    24 Mar 2010
    10 Apr 2011
    Link to this post
    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?
  3. Victor Velev
    Victor Velev avatar
    1345 posts
    Registered:
    06 Jul 2015
    11 Apr 2011
    Link to this post
    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

  4. Ben
    Ben avatar
    35 posts
    Registered:
    24 Jan 2011
    21 Dec 2011
    Link to this post
    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. 
  5. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    26 Dec 2011
    Link to this post
    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
  6. Ben
    Ben avatar
    35 posts
    Registered:
    24 Jan 2011
    03 Jan 2012
    Link to this post
    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. 
  7. Ben
    Ben avatar
    35 posts
    Registered:
    24 Jan 2011
    03 Jan 2012
    Link to this post
    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?
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Jan 2012
    Link to this post
    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
  9. Ben
    Ben avatar
    35 posts
    Registered:
    24 Jan 2011
    09 Jan 2012
    Link to this post
    Thanks Ivan. We'll see if we can upgrade. 
  10. Scott Bradley
    Scott Bradley avatar
    27 posts
    Registered:
    20 Jan 2010
    20 Jun 2012
    Link to this post
    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?
  11. Scott Bradley
    Scott Bradley avatar
    27 posts
    Registered:
    20 Jan 2010
    20 Jun 2012
    Link to this post
    ** duplicate post **
11 posts, 0 answered