Hello there,
Script below done in AIX/RS6000/DB2
--------------------
#!/bin/ksh
#---- Set Environment
mdmdb="mydatabase"
mdmdbuser="myusername"
mdmdbpwd="mypassword"
#---- Connect to the Database
db2 connect to $mdmdb user $mdmdbuser using $mdmdbpwd
#
# Whatever you want to do goes here...
#
#---- Terminate DB2
db2 terminate
Hope this helps.
Merry Christmas.