Environment differences and load paths with passenger?

14 views
Skip to first unread message

Mikel Lindsaar

unread,
Nov 15, 2008, 1:47:29 AM11/15/08
to phusion-...@googlegroups.com
OK... weird problem.

I have passenger running Rails 2.1 on FreeBSD.  Works fantastic.

I access MS SQLServer from the FreeBSD box as a read only data source (all my real work is done in PostgreSQL)

If I fire up irb, this works:

> require 'rubygems'
> require 'dbi'
> DBI.connect('dbi:odbc:aoshanzo', 'user', 'password')
=> #<DBI::DatabaseHandle:0x......

All OK.

If I log into the FreeBSD box and open up a console, I can access the MS SQLServer based models fine.

$ ./script/console
>> RoPerson.find(:first)
=> #<RoPerson pers_id: 12222.....

I can even fire up webrick on the production server and hit it on port 3000 and it accesses the MSSQL Server models fine.

But when I try and do it through a controller action through a passenger instance, I get:

A DBI::InterfaceError occurred in reports#create:

Could not load driver (no such file to load - odbc)
/usr/local/lib/site_ruby/1.8/dbi.rb:344:in 'load_driver'

Now the only thing I can see is that the passenger instance is hitting the site_ruby copy of dbi instead of the gem.  But how can I force it to use the gem version?

Putting config.gem dbi in the environment block doesn't seem to work.

Any ideas?

Mikel


Mikel Lindsaar

unread,
Nov 15, 2008, 2:59:01 AM11/15/08
to phusion-...@googlegroups.com
On Sat, Nov 15, 2008 at 5:47 PM, Mikel Lindsaar <raas...@gmail.com> wrote:
A DBI::InterfaceError occurred in reports#create:

Could not load driver (no such file to load - odbc)
/usr/local/lib/site_ruby/1.8/dbi.rb:344:in 'load_driver'

Further update.

I removed dbi and dbi-odbc from site_ruby and reinstalled them as gems only.

Same problem, now in the /usr/local/lib/ruby/gems/1.8/gems/dbi/dbi.rb:344 load driver.

Then removed all dbi related gems and reinstalled as site ruby (non gem version).

Same problem.

Either way, I can still query from irb or the console or using webrick.

Frustrating...

Mikel
 

Mikel Lindsaar

unread,
Nov 15, 2008, 3:48:53 AM11/15/08
to phusion-...@googlegroups.com
On Sat, Nov 15, 2008 at 6:59 PM, Mikel Lindsaar <raas...@gmail.com> wrote:
On Sat, Nov 15, 2008 at 5:47 PM, Mikel Lindsaar <raas...@gmail.com> wrote:
A DBI::InterfaceError occurred in reports#create:

Could not load driver (no such file to load - odbc)
/usr/local/lib/site_ruby/1.8/dbi.rb:344:in 'load_driver'

OK... I solved it.

Problem was that the odbc.so driver installed by /usr/ports/ruby/database/ruby-odbc was installing into /usr/local/lib/ruby/site_ruby/1.8/i386-freebsd7 and the ruby-dbi port was installing into i386-freebsd7.0

The handling was:

ln -s /usr/local/lib/ruby/site-ruby/1.8/i386-freebsd7.0 /usr/local/lib/ruby/site-ruby/1.8/i386-freebsd7

which is just _W_E_I_R_D_

The thing that really gets me is that it wouldn't work live in passenger, but on the same server, in production mode, the console and webrick and even irb all worked fine.

Anyway... hopefully useful for someone else.

Mikel


Reply all
Reply to author
Forward
0 new messages