I am trying to select some data from a DB2 table using REXX and I am receiving a -922 (access failure) when attempting to connect to the DB2 subsystem.
Does anyone know which plans are involved in the DB2/REXX interface?
You don't say which DB2 environment you're using.
On i-series you need to explicitly specify a read only cursor or have journalling applied to the table you're after
Also check that your have *READ rights to Collection/Table
This code works with REXX/400 DB2/400
/* LIST EMPLOYEES */
SAY ' '
SAY ' LIST OF EMPLOYEES'
SAY ' '
ADDRESS EXECSQL
SIGNAL ON ERROR
select_stmt = 'SELECT EFEMNO, EFSURN, EFFORN FROM CSEMPSPF FOR READ ONLY'
EXECSQL 'PREPARE S1 FROM :select_stmt'
EXECSQL 'DECLARE C1 CURSOR FOR S1'
EXECSQL 'OPEN C1 '
/* Fetch all of the rows */
DO UNTIL (SQLCODE <> 0)
EXECSQL 'FETCH C1 INTO :EMNO, :SURN, :FORN'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.