Home: Perl Programming Help: DBI:
DBD::ODBC runs manually, not via crontab


May 5, 2014, 8:01 AM

Views: 89165
DBD::ODBC runs manually, not via crontab

I installed DBD::ODBC and everything runs fine from a non-root account via command line, but just not via crontab. The module is located here:


I ran a crontab entry to capture the perl libraries from the account and I see the path :


Can someone help with what I'm missing, or help capturing what the error actually is? I am not even doing anything, like connecting to a DB. I just am running a bare bones perl script with the 'use DBD::ODBC' in it.

Veteran / Moderator

May 5, 2014, 11:42 PM

Views: 88866
Re: [islanderman] DBD::ODBC runs manually, not via crontab

I had a similar problem with an Oracle database: the script would run fine when launched manually from my account but would fail when launched vie the crontab. It turned out that the problem did not have to do with Perl (I reproduced it with a shell script and sqlplus commands), but with some environment variables needed to be able to connect to the Oracle database, which were not set for the root account. You might have a similar problem.