[unixODBC-support] [unixODBC][Driver Manager]Function sequence error

Volker Wysk pf3 at volker-wysk.de
Sun Sep 15 15:15:41 BST 2013


Hello!

I'm new to ODBC, and I get an error in a very minimalistic program. It just 
tries to connect to and disconnect from the database, and doesn't do anything. 
Here is what it does, error handling left out:

  SQLHENV     hEnv = 0;
  SQLHDBC     hDbc = 0;

  SQLAllocEnv(&hEnv);
  SQLAllocConnect(hEnv, &hDbc);
  SQLConnect(hDbc,
                     (SQLCHAR*) "test", 4,
                     (SQLCHAR*) "", 0,
                     (SQLCHAR*) "", 0);
  SQLFreeHandle(SQL_HANDLE_DBC, hDbc);   /* error here */
  SQLFreeEnv(hEnv);

I've attached the full program (named odbc.cpp) to this message. The error can 
be reproduced easily. Type this to compile it:

  gcc -o odbc odbc.cpp -lodbc -lsqlite3 -lstdc++

The call to SQLFreeHandle fails. Running the program produces the following 
error message:

  Can't free connection handle.
  ret = -1
  SQL error message: [unixODBC][Driver Manager]Function sequence error
  SQL_ERROR

If anyone has an idea, what a "Function sequence error" is, then please post 
it.

Thanks,
Volker
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20130915/46a170be/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: odbc.cpp
Type: text/x-c++src
Size: 1723 bytes
Desc: not available
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20130915/46a170be/attachment.bin>


More information about the unixODBC-support mailing list