AS/400 DB2 Queries via PHP

admin

Administrator
Staff member
Hi,

I have a Linux web server running Apache/PHP with DB2 7.1 for Linux installed. I can pull data off an AS/400 connected via the DB2 under Linux in simple queries - it was a job to even get THAT connectivity working. One problem though, I cannot update data on the AS/400 at all. No UPDATE, INSERT or DELETE statement works. I know you have to give the library name in the SQL query for the SQL statement to work. For example, on the statement:

UPDATE LIBRARY.FILE1 Set FIELD='100' WHERE FIELD2='10000'

I get an error 'SQL7008N REXX variable "FILE1 " contains inconsistent data.' where "FILE1" is just the AS/400 file (or table) name that I want to update.

I also get problems on trying an SQL JOIN too. Trying the following SQL:

SELECT * FROM LIBRARY.FILE1, LIBRARY.FILE2 WHERE LIBRARY.FILE1.FIELD1 = LIBRARY.FILE2.FIELD1 AND LIBRARY.FILE1.FIELD1='100000'

I get the error 'SQL0204N "LIBRARY.FILE2" is an undefined name.' when the table/file and all fields referenced DO exist. I tried this method too:

SELECT * FROM LIBRARY.FILE1 JOIN LIBRARY.FILE2 ON LIBRARY.FILE1.FIELD1=LIBRARY.FILE2.FIELD1 WHERE LIBRARY.FILE1.FIELD1='100000'

and I get the same error.

So, has anyone had these sorts of problems in getting PHP with DB2 on AS/400 functionality working?
Any help would be very much appreciated.

Thanks,

Derek
 
Back
Top