[unixODBC-dev] I am getting "Function Sequence Error" When I try to do SQLDescribeParam() using my native ODBC

Aniruddha Kulkarni aniruddha_kulkarni at persistent.co.in
Thu Nov 8 13:33:00 GMT 2012

Thanks a lot Martin for your reply. I will try to change the method calling sequence and see it is still failing.


-----Original Message-----
From: unixodbc-dev-bounces at mailman.unixodbc.org [mailto:unixodbc-dev-bounces at mailman.unixodbc.org] On Behalf Of Martin J. Evans
Sent: Thursday, November 08, 2012 6:56 PM
To: unixodbc-dev at mailman.unixodbc.org
Subject: Re: [unixODBC-dev] I am getting "Function Sequence Error" When I try to do SQLDescribeParam() using my native ODBC

On 08/11/12 12:24, Aniruddha Kulkarni wrote:
> Hi,
> I am stuck with some issue here. I am trying to do certain operations 
> on back-end using my native ODBC driver however when I call
> SQLDescribeParam() through my application it gives me an error as - 
> SQLDescribeParam -> Rc = SQL_ERROR, Msg = [unixODBC][Driver 
> Manager]Function sequence error

The driver manager issued the function sequence error as can be seen by "[unixODBC][Driver Manager]". If the driver reported the issue, it would be named in [] at the right.
> Here is the scenario which encountered this problem:
> 1>Connect to backend using SQLConnect()
> 2>Prepare an insert query having geometry as col type using
> SQLPrepare()
> 3>Set the statement attributes using SQLSetStmtAttr()

This is usually where you call SQLDescribeParam i.e., you need to describe the parameters before binding them.
> 4>Bind the parameters with the data type using SQLBindParameter()
> 5>Then execute the parameterized query using - SQLExecute()
> 6>Call SQLNumParams() on statement

Why would you want the number of parameters after execution. You normally do this before executing.
> 7>Then in a loop, call SQLDescribeParam() with the appropriate
> function arguments.

No idea why your ODBC application is doing this - why?
> With this sequence of functions I am getting the mentioned error. My 
> doubt is on unixODBC driver manager I have been using, because if I 
> try to run the application without DM then it works as expected. So I 
> believe there is some error that is caught by driver manager and error 
> is thrown.

It is caught by the driver manager.

> Can anybody please shed some light on the probable cause of the error?
> Thanks
> ~Aniruddha

I haven't got the ODBC book to hand but I'd guess it is a state transition that ODBC does not support. Currently, from what you've given us I can't see why you'd want to call SQLDescribeParam where are are.

Martin J. Evans
Easysoft Limited
unixODBC-dev mailing list
unixODBC-dev at mailman.unixodbc.org

This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.

More information about the unixODBC-dev mailing list