Totally stumped

Hi, everyone,
I'm have this issue where I'm using FreeTDS and unixODBC to connect to an
SQL Server database. The weird thing is that it works when I'm logged in,
running things from irb. However, if I start a process using cron, it
doesn't work. I've compared my PATH and $: in both environments and they're
the same ... are there any other things that might be different between the
cron environment and my login environment that may affect Ruby?

Thanks!

jw

jenny w wrote:

Hi, everyone,
I'm have this issue where I'm using FreeTDS and unixODBC to connect to an
SQL Server database. The weird thing is that it works when I'm logged in,
running things from irb. However, if I start a process using cron, it
doesn't work. I've compared my PATH and $: in both environments and they're
the same ... are there any other things that might be different between the
cron environment and my login environment that may affect Ruby?

What user is the cron task? What permissions?

···

--
James Britt

Same user is running cron. That's what makes this so perplexing. If I run
the job as that user from the command-line it works; if I run it through
cron as the same user, it doesn't. I get:

DBI::DatabaseError (IM002 (0) [unixODBC][Driver Manager]Data source name not
found, and no default driver specified):
    /usr/local/lib/site_ruby/1.8/DBD/ODBC/ODBC.rb:96:in `connect'
    /usr/local/lib/site_ruby/1.8/dbi/dbi.rb:584:in `connect'
    /usr/local/lib/site_ruby/1.8/dbi/dbi.rb:384:in `connect'

Thanks!

···

On Mon, Jun 2, 2008 at 6:10 PM, James Britt <james.britt@gmail.com> wrote:

What user is the cron task? What permissions?

Ack! Just figured out that the problem happens outside of Ruby, too. Once I
realized I could reproduce the issue with isql, I realized I was missing the
FREETDSCONF environment variable. D'oh!