CodeIgniter Forums

Full Version: DB2 - ODBC - transaction problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Greetings,

I have a problem where i need some help.

I have this in my model (call to a proceedure):


$sql="call proc.stored_procedure( ?, ?, 'PM', '0', cast(null as char), cast(null as char) )";
$this->db->query($sql, array($basketId, $firmNumber));

I am getting an error:
SQL0428N The SQL statement is only allowed as the first statement in a unit of work.

I have tried to use $this->db->trans_strict(FALSE); and $this->db->trans_off() before the call and it doesnt help.

The procedure call works if i call it in DbVisualizer or by using db2cmd.

It is a problem with transaction isolation.

Thank you for your hints.

with regards,

Marko
Most of the information I found on this error points to errors in the procedure, but you've already stated it works in other environments. Are you using the same account to connect to the database in those other tools as the account which is configured for CodeIgniter?

I've also found a few references in IBM's Knowledge Center about known issues which might cause these errors, but they're specific to using certain APIs or features, so the workarounds they provide may not be relevant. Most of them do seem to suggest setting autocommit mode or issuing a commit/rollback before/after the offending command in the stored procedure. Searching for "php SQL0428N" seemed to return a few potentially useful results.