Adding User access to DB2 I have installed DB2 10.1 in a Red hat box. During the installation I was asked to create several users (db2inst1, db2fenc1 etc). I have been using db2inst1 to perform all operations with DB2 and it works perfectly fine. The sqllib files are located in

/home/db2inst1/sqllib

The installation files are located in 

/opt/ibm/db2/V10.1/

All users have access to both these folders. I now want to perform the DB2 operations with another user, namely "john". Given that db2 uses the underlying user/password of the host machine, I added the groups dasadm1 and ds2iadm1 to the "john" user (which are the ones listed in db2inst1).


uid=500(john) gid=500(john) groups=500(john),101(dasadm1),102(db2iadm1)


I can properly enter the db2 cmd with the user "john"

[john@rhel6 java]$ /home/db2inst1/sqllib/bin/db2

but when I run my java app as user "john" I get the following error:


SQLException: com.ibm.db2.jcc.am.SqlException: [jcc][10389][12245][4.13.127] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: db2jcct2 (Not found in java.library.path):  ERRORCODE=-4472, SQLSTATE=null


this error does not appear if I run the same java app as user db2inst1. The library paths are the exactly the same for both users. Any idea what is going wrong?
My gut feeling is that you did not update user "john's" profile to invoke the DB2 profile setup. If you do not do this, then you won't have "access" to DB2 per say, even though the binaries are there.

So what you want to do is write a script that checks for your DB2 instance "home" profile script
in your case it would be /home/db2inst1/sqllib/db2profile and if it is there, to invoke it.

if [ -f /home/db2inst1/sqllib/db2profile ] ; then
     . /home/db2inst1/sqllib/db2profile
     if [ ! $? = 0 ] ; then
          echo "Error setting up DB2 instance access"
     else
          echo "DB2 instance access set up"
     fi
fi