This is a migrated thread and some comments may be shown as answers.

Prepared statement not getting created?

5 Answers 140 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Roger
Top achievements
Rank 1
Roger asked on 11 May 2010, 05:21 AM
I'm seeing an exception in my server environment that I don't see in development, resulting in the following exception:

Telerik.OpenAccess.Exceptions.DataStoreException: Error executing query: Telerik.OpenAccess.RT.sql.SQLException: Could not find prepared statement with handle -1.
   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeQuery()
   at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeQuery()
   at OpenAccessRuntime.Relational.fetch.FetchResultImp.execute()
SQL:
SELECT b.[ContactId], c.[NoteId], c.[EmployeeId], c.[EmployeeId], c.[IsDeleted], c.[ModifiedDate], c.[NoteText] FROM [Contact] a JOIN [Contact_Note] AS b ON (a.[ContactId] = b.[ContactId]) JOIN [Note] AS c ON (b.[NoteId] = c.[NoteId]) WHERE a.[ContactId] = ?         ORDER BY b.[ContactId]  Telerik.OpenAccess.RT.sql.SQLException: Could not find prepared statement with handle -1.
   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeQuery()
   at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeQuery()
   at OpenAccessRuntime.Relational.fetch.FetchResultImp.execute() ---> Telerik.OpenAccess.RT.sql.SQLException: Could not find prepared statement with handle -1.
   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeQuery()
   at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeQuery()
   at OpenAccessRuntime.Relational.fetch.FetchResultImp.execute()
   --- End of inner exception stack trace ---
   at Telerik.OpenAccess.RT.ExceptionWrapper.Throw()
   at OpenAccessRuntime.DataObjects.PCStateMan.handleException(Exception x)
   at OpenAccessRuntime.DataObjects.PCStateMan.getObjectFieldImp(PersistenceCapable pc, FieldMetaData fmd, Object currentValue)
   at OpenAccessRuntime.DataObjects.PCStateMan.getObjectField(PersistenceCapable pc, Int32 field, Object currentValue)


  • What does it mean that the prepared statement couldn't be found?
  • Why would this be happening on one machine and not another?
  • What can I do to fix this?

Thanks in advance for any help.

5 Answers, 1 is accepted

Sort by
0
Serge
Telerik team
answered on 11 May 2010, 12:33 PM
Hi Roger,

The problem here is either on our side or on the ADO.NET driver's side. Unfortunately we cannot reproduce this exact behavior for now. Can you please provide us with more information so that we can further investigate this issue. What is your database server? When is this exception thrown?

This might be caused by the database server if it is using some kind of a temporary storage for its prepared statements and it deletes them more often than it is supposed to. (A prepared statement, is a SQL statement that can be used multiple times with different parameters and it is stored on the server in order to get better performance).

Greetings,
Serge
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Roger
Top achievements
Rank 1
answered on 11 May 2010, 04:54 PM
Thanks, Serge, for your quick response.

I am running on SQL Server 2008, on Windows Server Standard (64-bit).  My dev system uses SQL Server 2005, on Windows 7 (64-bit).

The exception is thrown when the application is starting up, and I get exactly ten instances of the same message (reported earlier) in the Event Log.

I believe I have resolved the issue but I would still like an explanation.  All my executables and libraries are .NET 4.0.  In Visual Studio, I still need to reference Telerik.OpenAccess.35.Extensions in order to use the Extent extension.  I resolved the problem I was having on the server, though, by adding the Telerik.OpenAccess.40.Extensions library (i.e. both extension libraries exist side-by-side).  So here are what I don't understand:
  • Why, for a .NET 4 project, do I still need Telerik.OpenAccess.35.Extensions?  By experimentation, I see that having the Telerik.OpenAccess.40.Extensions library alone will not get me the Extent extension, so why isn't the Extent extension included in the Telerik.OpenAccess.40.Extensions library?
  • Why does my VS project not require the Telerik.OpenAccess.40.Extensions library to be included in its references, but the deployed application does require this assembly?

0
Accepted
Serge
Telerik team
answered on 13 May 2010, 05:40 PM
Hello Roger,

The Telerik.OpenAccess.35.Extensions assembly contains the base functionality and Telerik.OpenAccess.40.Extensions contain only functionality needed to run on the .NET 4.0. We know that this is a bit confusing and we are considering a change in this direction.

And to answer your question you need both assemblies. Is it possible to have missed the 40.Extensions when deploying your solution? This could answer why you encountered a problem. 

Is referencing this assembly all you have done to resolve your issue? If not please share it with us so we can investigate this issue further.

Have a great day,
Serge
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
James
Top achievements
Rank 1
answered on 21 Apr 2011, 08:26 AM
We have this error too for one of our users. Unable to replicate this myself, but another administrator can.

Could this be to do with an SQL timeout?
0
Zoran
Telerik team
answered on 22 Apr 2011, 07:42 AM
Hello James,

 Not his exception is not  related to SQL timeout, it is most probably a problem caused by missing assembly or maybe the database on the deployment server has different schema than the one on the development machine.

All the best,
Zoran
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Development (API, general questions)
Asked by
Roger
Top achievements
Rank 1
Answers by
Serge
Telerik team
Roger
Top achievements
Rank 1
James
Top achievements
Rank 1
Zoran
Telerik team
Share this question
or