Hi,
To make db2 connect in a sub shell, set the following shell environment variable :
export DB2DBDFT=yourda tabasename

(if you had a previous failed attempt to connect to the db you may need to do a "db2 terminate" first )