Skip to content

Instantly share code, notes, and snippets.

@kadler
Created February 19, 2019 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kadler/c6e7586cdcccdc47f9d4679be38d0628 to your computer and use it in GitHub Desktop.
Save kadler/c6e7586cdcccdc47f9d4679be38d0628 to your computer and use it in GitHub Desktop.
Setting up DB2 Connect packages

If PHP tests fail with

[IBM][CLI Driver][AS] SQL0805N  Package "NULLID.SYSSH000" was not found.  SQLSTATE=51002 SQLCODE=-805

You'll need to set up the DB2 Connect SQL packages by "binding" them.

From the clidriver directory

DBNAME=myrdb # RDB name for *LOCAL
HOSTNAME=myhostname
USER=myuser
PASSWORD=mypassword
LD_LIBRARY_PATH=$PWD/lib

bin/db2cli bind bnd/@db2cli.lst -database $DBNAME:$HOSTNAME:446 -user $USER -passwd $PASSWORD -options "blocking all grant public"

I'm not sure what the "blocking all grant public" does. Docs for BIND are here: https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0001935.html.

Output spews a bunch of messages, but apparently that's ok

LINE    MESSAGES FOR db2cli.lst
------  --------------------------------------------------------------------
        SQL0061W  The binder is in progress.

LINE    MESSAGES FOR db2clist.bnd
------  --------------------------------------------------------------------
  243   SQL0084N  An EXECUTE IMMEDIATE statement contains a SELECT or 
                  VALUES statement.  SQLSTATE=42612
  246   SQL0084N  An EXECUTE IMMEDIATE statement contains a SELECT or 
                  VALUES statement.  SQLSTATE=42612
  249   SQL0084N  An EXECUTE IMMEDIATE statement contains a SELECT or 
                  VALUES statement.  SQLSTATE=42612
  285   SQL0104N  An unexpected token "EXPLAIN" was found following 
                  "".  Expected tokens may include:  "DEGREE".  SQLSTATE=42601
  288   SQL0104N  An unexpected token "EXPLAIN" was found following 
                  "".  Expected tokens may include:  "DEGREE".  SQLSTATE=42601
  291   SQL0104N  An unexpected token "QUERY" was found following "". 
                  Expected tokens may include:  "DEGREE".  SQLSTATE=42601
  297   SQL0104N  An unexpected token "EXPLAIN" was found following 
                  "".  Expected tokens may include:  "DEBUG".  SQLSTATE=42601
  300   SQL0104N  An unexpected token "EXPLAIN" was found following 
                  "".  Expected tokens may include:  "DEBUG".  SQLSTATE=42601
  303   SQL0104N  An unexpected token "REFRESH" was found following 
                  "".  Expected tokens may include:  "DEGREE".  SQLSTATE=42601
  306   SQL0104N  An unexpected token "DEFAULT" was found following 
                  "".  Expected tokens may include:  "DEGREE".  SQLSTATE=42601

LINE    MESSAGES FOR db2cli.bnd
------  --------------------------------------------------------------------
        SQL0204N  "QSYS.NEWTON" is an undefined name.  SQLSTATE=42704
        SQL0204N  "NEWTON.DB2CLI" is an undefined name.  
                  SQLSTATE=42704
        SQL0204N  "NEWTON.DB2CLI" is an undefined name.  
                  SQLSTATE=42704

LINE    MESSAGES FOR db2cli.lst
------  --------------------------------------------------------------------
        SQL0082C  An error has occurred which has terminated 
                  processing.
        SQL0091N  Binding was ended with "4" errors and "10" 
                  warnings.
@PaulIvanov
Copy link

Thank you for this. This worked for me while attempting to solve the same issue in the IBM.Data.DB2.EntityFramework nuget Package. The only thing I had to change was making the paths windows style filepaths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment