I have written a multithreaded ODBC program which tries to insert data to 11
tables in MonetDB. Each thread has a connection handle, a statment handle
(comprising of insert into blah!....). Each thread on instantiation creates
the handles (connection, statement etc.), connects to the db, binds
meta-data, prepares query and executes the insert in a loop after reading
the bind values from a file. The program runs fine to a point following
which:
SQLExecute: Error: SQLstate HY010, Errnr 0, Message [MonetDB][ODBC Driver
1.0]Function sequence error
On closer examination it's the statement handle that is not in Prepared
state. I thought that this maybe because the asynchronous execution of the
previous execution of the commit isn't complete yet.
I recoded my commit as follows:

ret_sts = SQLEndTran(SQL_HANDLE_DBC, dbch, SQL_COMMIT);
        while (ret_sts == SQL_STILL_EXECUTING)
          ret_sts = SQLEndTran(SQL_HANDLE_DBC, dbch, SQL_COMMIT);
        check(ret_sts, SQL_HANDLE_DBC, dbch, "SQLEndTran");
However, the ret_sts returns -1 which means a SQL_ERROR
This has me perplexed. Clearly the SQL is good else it wouldn't have
executed a no. of times in the first place. The stmth also look good, so
there is no stepping by threads on each others memory. I can post the whole
program if needed.

-- 
View this message in context: 
http://old.nabble.com/Function-Sequence-Error-tp29148164p29148164.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to