SQL insert error in php

1975 pts.
Tags:
AS/400
IBM DB2
PHP
SQL
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

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    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
    125,585 pointsBadges:
    report
  • aceofdelts
    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.
    1,975 pointsBadges:
    report
  • aceofdelts
    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.
    1,975 pointsBadges:
    report
  • TomLiotta
    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
    125,585 pointsBadges:
    report
  • aceofdelts
    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.
    1,975 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following