## Cron often clears the whole $PATH environment
## So the shell doesn't know where to look for the command
## You should set the $PATH enviorment in crontab:
PATH="/usr/local/bin:/usr/bin:/bin"
0 1 * * * db2 connect to myDB2
## Or add the $PATH enviorment in your script:
#!/bin/bash
PATH="/usr/local/bin:/usr/bin:/bin"
# rest of script follows