Insufficient access privilege for table

ChezJfrey

New Member
The COMPILE statement below throws this error: Insufficient access privilege for table MyTable. (234). I checked the data security for AS400 db using Data Admin and each table throwing the error has complete access. The calling program resides on a WIN2k machine and is initially connected to the native database. MyProcedure uses tables from both the WIN2k and the AS400 (which as you may guess resides on an IBM AS400).

IF NOT CONNECTED("AS400") THEN
DO:
CONNECT AS400schema -H schemaserve -S schemaservice NO-ERROR.
CONNECT AS400 -Dsrv COMPRESS=1 -dt AS400 -H server -S service -U user -P password NO-ERROR.
END.
IF CONNECTED("AS400") AND NOT ERROR-STATUS:ERROR THEN
COMPILE VALUE("MyProcedure.p").

The compilation error occurs on the first line of the following

FOR EACH AS400.MyTable FIELDS(Field1 Field2) WHERE
NOT CAN-FIND(WIN2k.MyTable WHERE
WIN2k.MyTable.Field1 = AS400.MyTable.Field1 AND
WIN2k.MyTable.Field1 = AS400.MyTable.Field1)
SHARE-LOCK:
DELETE AS400.MyTable NO-ERROR.
END.

Strangely enough, just a few lines above this in the procedure, presumabely where a compilation error would first occur, I find the code below, but I don't receive a compilation error.

FOR EACH WIN2k.MyTable WHERE SomeField = Something NO-LOCK:
FOR EACH AS400.MyTable WHERE
WIN2k.MyTable.Field1 = AS400.MyTable.Field1 AND
WIN2k.MyTable.Field1 = AS400.MyTable.Field1
SHARE-LOCK:
.
.
END.
END.

Can anyone point to the problem or suggest a place to look?
 

ChezJfrey

New Member
SOLVED: Insufficient access privelege, But ?? remain

Trial and error has uncovered a solution, but I am puzzled. I wrote out the DBPARAM() strings for each connected db and found that the WIN2k db did not have a username. The program was launched with a -pf specified that did not supply it. This was the only difference between what was running from the editor and the compiled code. Supplying a username (for the WIN2k db) enabled the program to access the db on the AS400 without the insufficient access privelege error. But how and why? The program starts by accessing the db on WIN2k, connects to the AS400, accesses AS400 db. I always supplied a username/pwd to connect to the AS400 and the DBPARAM() confirmed this. So without a username for WIN2k, I was able to access the db, but after I connect to AS400 (with name/pwd) and try to access the AS400 db I received the error. Why not for the WIN2k? Why throw the error when I reference the AS400 when I really do have a name/pwd?
 
Top