Skip to Content.
Sympa Menu

freetds - Re: [freetds] [FreeTDS][SQL Server]Invalid cursor state error when using 2 statements from a connection.

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: jklowden AT schemamania.org
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] [FreeTDS][SQL Server]Invalid cursor state error when using 2 statements from a connection.
  • Date: Fri, 13 Jan 2012 10:32:19 -0500

On Thu, Jan 05, 2012 at 07:12:48PM +0530, BALAKRISHNAN RAJKUMAR wrote:
> Hi All,
>
>
> I am obtaining two handles from a connection and trying two execute
> two queries on successive lines. While the first execute statement
> succeeds, the second one reports this "invalid cursor state" error. Can we
> use more thane one statement using the same connection in FreeTDS. Could
> some one please clarify.

Please see http://www.freetds.org/faq.html#pending.

The message is an example of the disadvantage of mediation. DB-Library was
designed for TDS, and produces message 20019: "Attempt to initiate a
new Adaptive Server operation with results pending". ODBC has no
protocol-specific error message, even though it has protocol-specific,
implementation-defined *behavior*. Unable to say anything specific, it says

Invalid cursor state

which means,

http://msdn.microsoft.com/en-us/library/windows/desktop/ms713584%28v=vs.85%29.aspx

"A cursor was positioned on the StatementHandle by SQLFetch or
SQLFetchScroll. This error is returned by the Driver Manager if SQLFetch or
SQLFetchScroll has not returned SQL_NO_DATA, and is returned by the driver if
SQLFetch or SQLFetchScroll has returned SQL_NO_DATA."

In simpler words, you cannot call SQLExecute until SQLFetch returns
SQL_NO_DATA.

HTH.

--jkl






Archive powered by MHonArc 2.6.24.

Top of Page