Prepared Statements and Commands Out of Sync
Posted by: Denise Flinchbaugh
Date: July 22, 2010 02:26PM

I am wanting to confirm my understanding from research on this issue.

THE PROBLEM:

I am using prepared statements with both input and result bind variables. Everything is fine the first time I call a prepared statement (init, prepare, bind input, execute, bind output, free result, close stmt). The second time I call the same statement (stuff has happened in between), I issue the init - no problem - handle id is returned. I issue the prepare and get: Error 2014: Commands out of sync; you can't run this command now. I have verified by stepping through the code line by line in debugger that any open result sets from any queries (prepared or otherwise) have been closed prior to the call being made. I also know from previous execution of statement first time around that commands are in order (plus verified against documentation).

I have read through the manuals, blogs, bug reports and crawled extensively through the web looking for information. Based on some of that information, I have some alternatives as to what may be the problem.

QUESTIONS:

1. I saw a bug report for version 6.0 of the Connector (http://bugs.mysql.com/bug.php?id=39519) that indicated mysql_stmt_close was not properly freeing up everything and causing this error on subsequent requests. Was this also a problem in versions 5.0 and 5.1?
2. I saw a reply from February, 2009, on this forum (http://forums.mysql.com/read.php?168,238786,247628) to a question of a similiar nature that regarded getting this error. It says you can not have two or more active result sets on the same connection. Is this true (now or then)?
3. Any other enlightenment and suggestions on fixing this problem would be greatly welcome!

Thanks,
Denise

Options: ReplyQuote


Subject
Views
Written By
Posted
Prepared Statements and Commands Out of Sync
4791
July 22, 2010 02:26PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.