When my php executes the db2 insert, I get error 7008. Any ideas what I might try to get it working ? The PF is new with *all public authority and no trigger nor journal. I manually added 1 record via green-screen SQL with the same context as what is assembled in my php. Here's the actual code in case it helps // Write data to file if ($StepFlag == 'W') { $query9 = "INSERT INTO vaimodsdta.pndagrp (PARFBY, PAFNAM, PAFID) values ('".(int)$RepNumber."', '".trim($_POST['FName'])."', '".(int)($_POST['FID'])."')"; $stmt= db2_prepare($conn_resource, $query9); if (!$stmt) {echo 'Insert prepare failed';} else { $res = db2_execute($stmt); if (!$res) { echo 'The db2 write failed. '; echo $query9; echo 'SQLSTATE value: ' . db2_stmt_error(); echo ' Message: ' . db2_stmt_errormsg(); } } }
Software/Hardware used:
as400
ASKED:
March 19, 2013 9:20 PM
What is the reason code? A look at SQL7008 shows that reason code 3 can be caused when “&1 not journaled, no authority to the journal, or the journal state is *STANDBY. Files with an RI constraint action of CASCADE, SET NULL, or SET DEFAULT must be journaled to the same journal.” Any connection there to the file description? — Tom
unable to see the reason code (is there a technique to grab it ?), but file is not journaled. this “feels” like a security issue but not anxious to go down that path on only a hunch.
if it matters, I simplified the insert & also tried as an “update” and still get the same error. Same thing using a different (1-field) file (with no journal, no triggers) and using a UserID with a bit more authority (still limited). The SQL-select works fine.
First thing I’d try is to journal the file. If the error goes away and you don’t want to journal the file, next thing I’d do is end journaling and add an isolation level clause to the INSERT statement, e.g., [ WITH NC ]. — Tom
ok-I’m told that the setup of the iseries (to which I was trying to write) does not allow writes. Not sure why, but our “internet” iseries does. So I’m able to get the write to work now ! Still some issues to get here – mainly the Database value had to be “*LOCAL” (not the IP addr or alias) because it’s the same box that has my php.
Tom-Thanks for the ideas. It helps to rule out some possible points of failure.