CodeIgniter Forums
DB2 - ODBC - transaction problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: DB2 - ODBC - transaction problem (/showthread.php?tid=63128)



DB2 - ODBC - transaction problem - Kozy - 09-29-2015

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


RE: DB2 - ODBC - transaction problem - mwhitney - 09-29-2015

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.