PHP DB2 on IBMi error: MYTABLE in MYFILE not valid for operation. SQLCODE=-7008

UPDATE:  Make sure to check if i5_allow_commit is not 0 (No Commit *NC *NONE).  You can check by running this in your PHP code

var_dump(ini_get(‘ibm_db2.i5_allow_commit’));

If the value is not 0 you might fix the problem by setting it to 0 in /usr/local/zendsvr/etc/conf.d/ibm_db2.ini and doing an Apache restart on Zend Server going to the 5250 typing “GO ZENDSVR/ZSMENU” option 6, option 5.

In case you run into the issue where your SQL updates and inserts statements aren’t processing you may want to try appending “WITH NONE” to the SQL statement.

When I ran the update statement

UPDATE MYFILE.MYTABLE SET FIELD1 = ? WHERE FIELD2 = ?

I got

MYTABLE in MYFILE not valid for operation. SQLCODE=-7008

Its a new file created via SQL
When I added WITH NONE it works

UPDATE MYFILE.MYTABLE SET FIELD1 = ? WHERE FIELD2 = ? WITH NONE

Even hard coding the values created the same error.  The problem appears to be a commitment control / journaling issue with IBMi DB2 connection.  You could try to change the settings of your connection.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s