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

Martin J. Evans martin.evans at easysoft.com
Thu Nov 8 13:26:06 GMT 2012


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
-- 
Martin J. Evans
Easysoft Limited
http://www.easysoft.com


More information about the unixODBC-dev mailing list