MySQL Forums
Forum List  »  Connector/C++

Stored procedure + preparedStatement + autocommit=0 doesn't work!
Posted by: Giovanni Romano
Date: March 22, 2012 01:52PM

Hello,
i don't understand what is going to happen...
this is my simple code:
--------------------------------------------------------------------------
conn->setAutoCommit(0);
preparedStmt = conn->prepareStatement("call spLogin(?,?,?)");
preparedStmt->setString(1, (const caracter *) username);
preparedStmt->setString(2, (const caracter *) password);
preparedStmt->setInt(3, age);
ret = preparedStmt->executeQuery();
if (ret->next()) {
id_user = ret->getInt(1)); // idUserinfo
conn->commit(); <-- THIS LINE DOES NOTHING!!!
}

When I execute the commit function no record was updated in the database.
If I replace the stored with embedded SQL it works very well!

Options: ReplyQuote


Subject
Views
Written By
Posted
Stored procedure + preparedStatement + autocommit=0 doesn't work!
2606
March 22, 2012 01:52PM


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.