public
Description: Oracle enhaced adapter for ActiveRecord
Home | Edit | New

Troubleshooting

What to do if Oracle enhanced adapter is not working?

Please verify that

1. Oracle Instant Client is installed correctly

Can you connect to database using sqlnet?

2. ruby-oci8 1.0.3 is installed correctly

Try something like:


ruby -r oci8 -e “OCI8.new(’user’, ‘password’,‘database’).exec(’select * from dual’) do |r| puts r.join(’,’); end”

to verify that ruby-oci8 is working

3. Verify that activerecord-oracle_enhanced-adapter is working from irb

require ‘rubygems’
gem ‘activerecord’
gem ‘activerecord-oracle_enhanced-adapter’
require ‘activerecord’
ActiveRecord::Base.establish_connection(:adapter => “oracle_enhanced”, :database => “database”,:username => “user”,:password => “password”)

and see if it is successful (use your correct database, username and password)

What to do if Oracle enhanced adapter is not working with Phusion Passenger?

Oracle Instant Client and ruby-oci8 requires that several environment variables are set:

  • LD_LIBRARY_PATH (on Linux) or DYLD_LIBRARY_PATH (on Mac) should point to Oracle Instant Client directory (where Oracle client shared libraries are located)
  • TNS_ADMIN should point to directory where tnsnames.ora file is located
  • NLS_LANG should specify which territory and language NLS settings to use and which character set to use (e.g. “AMERICAN_AMERICA.UTF8”)

When Apache with Phusion Passenger (mod_passenger or previously mod_rails) is used for Rails application deployment then by default ruby is launched without environment variables that you have set in shell profile scripts (e.g. .profile). Therefore it is necessary to set environment variables in one of the following ways:

  • Create wrapper script as described in Phusion blog or rayapps blog
  • Set environment variables in the file which is used by Apache before launching Apache worker processes – on Linux it typically is envvars file (look in apachectl or apache2ctl script where it is looking for envvars file) or /System/Library/LaunchDaemons/org.apache.httpd.plist on Mac OS X. See the following discussion thread for more hints.
  • Last edited by rsim, Sat Jan 03 12:12:45 -0800 2009
    Home | Edit | New
    Versions: