Now, what is really odd is that apache" + mod_rails are working fine,
with or without that config.gem. Speaking of oddities (which might be
unrelated):
$ ruby -r oci8 -e "OCI8.new('c', 'b','c').exec('select * from dual')
do |r| puts r.join(','); end"
ruby: no such file to load -- oci8 (LoadError)
$ irb
>> require 'oci8'
=> true
>> OCI8.new('c', 'b','c').exec('select * from dual') do |r| puts r.join(','); end
=> 1
The activerecord test works too and
$ ruby -r rubygems -e 'puts Gem.path'
/opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8
/var/lib/gems/1.8
which is expected and the obi8 lib is installed there
$ ls -d /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/
ruby-oci8-1.0.3
/opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/ruby-
oci8-1.0.3
1. Do you have just Ruby Enterprise Edition on this computer? No
original MRI? (Just wanted to be sure that there are no conflicts
between different Ruby installations)
2. It seems that there are some issues with oci8 installation if you
got "no such file to load" issue. Have you compiled and installed ruby-
oci8 library or have you installed it with "gem install ruby-oci8"?
If you have installed as gem then try
require ‘rubygems’
gem ‘ruby-oci8’
require 'oci8'
OCI8.new('user', 'password', 'database').exec('select * from dual') do
|r| puts r.join(','); end
if successful it should return X from this select.
2. Is activerecord-oracle_enhanced-adapter installed?
gem list activerecord-oracle_enhanced-adapter
3. Verify that activerecord-oracle_enhanced-adapter is working from
irb:
> Now, what is really odd is that apache" + mod_rails are working fine,
> with or without that config.gem. Speaking of oddities (which might be
> unrelated):
> $ ruby -r oci8 -e "OCI8.new('c', 'b','c').exec('select * from dual')
> do |r| puts r.join(','); end"
> ruby: no such file to load -- oci8 (LoadError)
> $ irb>> require 'oci8'
> => true
> >> OCI8.new('c', 'b','c').exec('select * from dual') do |r| puts r.join(','); end
> => 1
> The activerecord test works too and
> $ ruby -r rubygems -e 'puts Gem.path'
> /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8
> /var/lib/gems/1.8
> which is expected and the obi8 lib is installed there
> $ ls -d /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/
> ruby-oci8-1.0.3
> /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/ruby-
> oci8-1.0.3
thanks for your time. See below for all the answers.
On Dec 15, 10:41 pm, Raimonds Simanovskis
<raimonds.simanovs...@gmail.com> wrote:
> 1. Do you have just Ruby Enterprise Edition on this computer? No
> original MRI? (Just wanted to be sure that there are no conflicts
> between different Ruby installations)
I thought this could be the problem. I had ruby-1.8 and ruby-1.9
installed but removed them and the problem still persists.
> 2. It seems that there are some issues with oci8 installation if you
> got "no such file to load" issue. Have you compiled and installed ruby-
> oci8 library or have you installed it with "gem install ruby-oci8"?
> If you have installed as gem then try
> require ‘rubygems’
> gem ‘ruby-oci8’
> require 'oci8'
> OCI8.new('user', 'password', 'database').exec('select * from dual') do
> |r| puts r.join(','); end
> if successful it sho1uld return X from this select.
$ /opt/ruby/bin/ruby <<EOF
require 'rubygems'
gem 'ruby-oci8'
require 'oci8'
OCI8.new('u', 'p', 'db').exec('select * from dual') do |r| puts r.join
(','); end
EOF
X
> 2. Is activerecord-oracle_enhanced-adapter installed?
> gem list activerecord-oracle_enhanced-adapter
>> class Tester < ActiveRecord::Base
>> set_table_name('dual')
>> end
=> nil
>> Tester.find_by_sql('select sysdate as d from dual')[0].d
=> Tue Dec 16 15:44:42 0900 2008
> and see if it is successful (use your correct database, username and
> password)
> As I understand your previous post is related to the same issue?
not really (as far as I understand), Rails was complaining about that.
To work it around I installed the gem in the Rails tree (using rails
2.2.0 and rake gems:install) and added the definition as outlined in
my previous post.
OK, so it seems that all the components (ruby-oci8 and
oracle_enahnced) are working.
Then the question about your environment.rb. I use the following line
there:
config.gem "activerecord-oracle_enhanced-adapter", :lib =>
"active_record/connection_adapters/oracle_enhanced_adapter"
Do you use it in the same way?
In addition I am also using ruby-plsql gem and have the following line
in environment.rb:
config.gem "ruby-plsql", :lib => "ruby_plsql"
oracle_enhanced tries to require ruby-plsql library as well but if it
is missing then it should work also without it.
But maybe you can try to install ruby-plsql gem as well and include it
in your environment.rb file.
Raimonds
On Dec 16, 8:50 am, Mattia <malat...@gmail.com> wrote:
> thanks for your time. See below for all the answers.
> On Dec 15, 10:41 pm, Raimonds Simanovskis
> <raimonds.simanovs...@gmail.com> wrote:
> > 1. Do you have just Ruby Enterprise Edition on this computer? No
> > original MRI? (Just wanted to be sure that there are no conflicts
> > between different Ruby installations)
> I thought this could be the problem. I had ruby-1.8 and ruby-1.9
> installed but removed them and the problem still persists.
> > 2. It seems that there are some issues with oci8 installation if you
> > got "no such file to load" issue. Have you compiled and installed ruby-
> > oci8 library or have you installed it with "gem install ruby-oci8"?
> > If you have installed as gem then try
> > require ‘rubygems’
> > gem ‘ruby-oci8’
> > require 'oci8'
> > OCI8.new('user', 'password', 'database').exec('select * from dual') do
> > |r| puts r.join(','); end
> > if successful it sho1uld return X from this select.
> $ /opt/ruby/bin/ruby <<EOF
> require 'rubygems'
> gem 'ruby-oci8'
> require 'oci8'
> OCI8.new('u', 'p', 'db').exec('select * from dual') do |r| puts r.join
> (','); end
> EOF
> X
> > 2. Is activerecord-oracle_enhanced-adapter installed?
> > gem list activerecord-oracle_enhanced-adapter
> => #<ActiveRecord::Base::ConnectionSpecification:0x99518f8
> @adapter_method="oracle_enhanced_connection", @config=
> {:database=>"db", :username=>"u", :adapter=>"oracle_enhanced", :password=>"p"}>> class Tester < ActiveRecord::Base
> >> set_table_name('dual')
> >> end
> => nil
> >> Tester.find_by_sql('select sysdate as d from dual')[0].d
> => Tue Dec 16 15:44:42 0900 2008
> > and see if it is successful (use your correct database, username and
> > password)
> > As I understand your previous post is related to the same issue?
> not really (as far as I understand), Rails was complaining about that.
> To work it around I installed the gem in the Rails tree (using rails
> 2.2.0 and rake gems:install) and added the definition as outlined in
> my previous post.
When using the oracle_enhanced adapter with REE, I've had to install
both the ruby-oci8 library and the gem to get it to work.
Also if you want to use it with passenger, then you'll need pass the
LD_LIBRARY_PATH to passenger, since it doesn't take it from the
environment, there's a lil' hack I've found somewhere, I just don't
have it right now. Let me know if you need it, so I search for it.
<raimonds.simanovs...@gmail.com> wrote:
> OK, so it seems that all the components (ruby-oci8 and
> oracle_enahnced) are working.
> Then the question about your environment.rb. I use the following line
> there:
> config.gem "activerecord-oracle_enhanced-adapter", :lib =>
> "active_record/connection_adapters/oracle_enhanced_adapter"
> Do you use it in the same way?
> In addition I am also using ruby-plsql gem and have the following line
> in environment.rb:
> config.gem "ruby-plsql", :lib => "ruby_plsql"
> oracle_enhanced tries to require ruby-plsql library as well but if it
> is missing then it should work also without it.
> But maybe you can try to install ruby-plsql gem as well and include it
> in your environment.rb file.
> Raimonds
> On Dec 16, 8:50 am, Mattia <malat...@gmail.com> wrote:
> > Hi Ray,
> > thanks for your time. See below for all the answers.
> > On Dec 15, 10:41 pm, Raimonds Simanovskis
> > <raimonds.simanovs...@gmail.com> wrote:
> > > 1. Do you have just Ruby Enterprise Edition on this computer? No
> > > original MRI? (Just wanted to be sure that there are no conflicts
> > > between different Ruby installations)
> > I thought this could be the problem. I had ruby-1.8 and ruby-1.9
> > installed but removed them and the problem still persists.
> > > 2. It seems that there are some issues with oci8 installation if you
> > > got "no such file to load" issue. Have you compiled and installed ruby-
> > > oci8 library or have you installed it with "gem install ruby-oci8"?
> > > If you have installed as gem then try
> > > require ‘rubygems’
> > > gem ‘ruby-oci8’
> > > require 'oci8'
> > > OCI8.new('user', 'password', 'database').exec('select * from dual') do
> > > |r| puts r.join(','); end
> > > if successful it sho1uld return X from this select.
> > $ /opt/ruby/bin/ruby <<EOF
> > require 'rubygems'
> > gem 'ruby-oci8'
> > require 'oci8'
> > OCI8.new('u', 'p', 'db').exec('select * from dual') do |r| puts r.join
> > (','); end
> > EOF
> > X
> > > 2. Is activerecord-oracle_enhanced-adapter installed?
> > > gem list activerecord-oracle_enhanced-adapter
> > => #<ActiveRecord::Base::ConnectionSpecification:0x99518f8
> > @adapter_method="oracle_enhanced_connection", @config=
> > {:database=>"db", :username=>"u", :adapter=>"oracle_enhanced", :password=>"p"}>> class Tester < ActiveRecord::Base
> > >> set_table_name('dual')
> > >> end
> > => nil
> > >> Tester.find_by_sql('select sysdate as d from dual')[0].d
> > => Tue Dec 16 15:44:42 0900 2008
> > > and see if it is successful (use your correct database, username and
> > > password)
> > > As I understand your previous post is related to the same issue?
> > not really (as far as I understand), Rails was complaining about that.
> > To work it around I installed the gem in the Rails tree (using rails
> > 2.2.0 and rake gems:install) and added the definition as outlined in
> > my previous post.
I also just found that the issue is that Passenger starts with very
few environment variables and actually ruby-oci8 library cannot be
load because of missing LD_LIBRARY_PATH environment variable.
Try to put in environment.rb
require "oci8"
before
config.gem "activerecord-oracle_enhanced-adapter", ...
to verify if you can load oci8 library.
Recently I found that you can also use envvars file for setting Apache
environment variables but somehow it does not work anymore on my Mac
(the file is /usr/sbin/envvars and it is executed in apachectl
script). If anyone knows what could be the issue I would like to hear
it.
> When using the oracle_enhanced adapter with REE, I've had to install
> both the ruby-oci8 library and the gem to get it to work.
> Also if you want to use it with passenger, then you'll need pass the
> LD_LIBRARY_PATH to passenger, since it doesn't take it from the
> environment, there's a lil' hack I've found somewhere, I just don't
> have it right now. Let me know if you need it, so I search for it.
> On Dec 16, 11:59 am, Raimonds Simanovskis
> <raimonds.simanovs...@gmail.com> wrote:
> > OK, so it seems that all the components (ruby-oci8 and
> > oracle_enahnced) are working.
> > Then the question about your environment.rb. I use the following line
> > there:
> > config.gem "activerecord-oracle_enhanced-adapter", :lib =>
> > "active_record/connection_adapters/oracle_enhanced_adapter"
> > Do you use it in the same way?
> > In addition I am also using ruby-plsql gem and have the following line
> > in environment.rb:
> > config.gem "ruby-plsql", :lib => "ruby_plsql"
> > oracle_enhanced tries to require ruby-plsql library as well but if it
> > is missing then it should work also without it.
> > But maybe you can try to install ruby-plsql gem as well and include it
> > in your environment.rb file.
> > Raimonds
> > On Dec 16, 8:50 am, Mattia <malat...@gmail.com> wrote:
> > > Hi Ray,
> > > thanks for your time. See below for all the answers.
> > > On Dec 15, 10:41 pm, Raimonds Simanovskis
> > > <raimonds.simanovs...@gmail.com> wrote:
> > > > 1. Do you have just Ruby Enterprise Edition on this computer? No
> > > > original MRI? (Just wanted to be sure that there are no conflicts
> > > > between different Ruby installations)
> > > I thought this could be the problem. I had ruby-1.8 and ruby-1.9
> > > installed but removed them and the problem still persists.
> > > > 2. It seems that there are some issues with oci8 installation if you
> > > > got "no such file to load" issue. Have you compiled and installed ruby-
> > > > oci8 library or have you installed it with "gem install ruby-oci8"?
> > > > If you have installed as gem then try
> > > > require ‘rubygems’
> > > > gem ‘ruby-oci8’
> > > > require 'oci8'
> > > > OCI8.new('user', 'password', 'database').exec('select * from dual') do
> > > > |r| puts r.join(','); end
> > > > if successful it sho1uld return X from this select.
> > > => #<ActiveRecord::Base::ConnectionSpecification:0x99518f8
> > > @adapter_method="oracle_enhanced_connection", @config=
> > > {:database=>"db", :username=>"u", :adapter=>"oracle_enhanced", :password=>"p"}>> class Tester < ActiveRecord::Base
> > > >> set_table_name('dual')
> > > >> end
> > > => nil
> > > >> Tester.find_by_sql('select sysdate as d from dual')[0].d
> > > => Tue Dec 16 15:44:42 0900 2008
> > > > and see if it is successful (use your correct database, username and
> > > > password)
> > > > As I understand your previous post is related to the same issue?
> > > not really (as far as I understand), Rails was complaining about that.
> > > To work it around I installed the gem in the Rails tree (using rails
> > > 2.2.0 and rake gems:install) and added the definition as outlined in
> > > my previous post.
I found how to correctly add environment variables to Apache httpd
process in Mac OS X 10.5.
Edit /System/Library/LaunchDaemons/org.apache.httpd.plist
and add the following lines after <dict> line:
Adjust environment variables according to your Oracle Instant Client
location.
On Linux it seems that you should use envvars file to set up Apache
environment variables. Look in your apachectl (or apache2ctl) script
where it is looking for envvars file.
<raimonds.simanovs...@gmail.com> wrote:
> I also just found that the issue is that Passenger starts with very
> few environment variables and actually ruby-oci8 library cannot be
> load because of missing LD_LIBRARY_PATH environment variable.
> Try to put in environment.rb
> require "oci8"
> before
> config.gem "activerecord-oracle_enhanced-adapter", ...
> to verify if you can load oci8 library.
> Recently I found that you can also use envvars file for setting Apache
> environment variables but somehow it does not work anymore on my Mac
> (the file is /usr/sbin/envvars and it is executed in apachectl
> script). If anyone knows what could be the issue I would like to hear
> it.
> On Dec 16, 8:46 pm, theturingmachine <theturingmach...@gmail.com>
> wrote:
> > When using the oracle_enhanced adapter with REE, I've had to install
> > both the ruby-oci8 library and the gem to get it to work.
> > Also if you want to use it with passenger, then you'll need pass the
> > LD_LIBRARY_PATH to passenger, since it doesn't take it from the
> > environment, there's a lil' hack I've found somewhere, I just don't
> > have it right now. Let me know if you need it, so I search for it.
> > On Dec 16, 11:59 am, Raimonds Simanovskis
> > <raimonds.simanovs...@gmail.com> wrote:
> > > OK, so it seems that all the components (ruby-oci8 and
> > > oracle_enahnced) are working.
> > > Then the question about your environment.rb. I use the following line
> > > there:
> > > config.gem "activerecord-oracle_enhanced-adapter", :lib =>
> > > "active_record/connection_adapters/oracle_enhanced_adapter"
> > > Do you use it in the same way?
> > > In addition I am also using ruby-plsql gem and have the following line
> > > in environment.rb:
> > > config.gem "ruby-plsql", :lib => "ruby_plsql"
> > > oracle_enhanced tries to require ruby-plsql library as well but if it
> > > is missing then it should work also without it.
> > > But maybe you can try to install ruby-plsql gem as well and include it
> > > in your environment.rb file.
> > > Raimonds
> > > On Dec 16, 8:50 am, Mattia <malat...@gmail.com> wrote:
> > > > Hi Ray,
> > > > thanks for your time. See below for all the answers.
> > > > On Dec 15, 10:41 pm, Raimonds Simanovskis
> > > > <raimonds.simanovs...@gmail.com> wrote:
> > > > > 1. Do you have just Ruby Enterprise Edition on this computer? No
> > > > > original MRI? (Just wanted to be sure that there are no conflicts
> > > > > between different Ruby installations)
> > > > I thought this could be the problem. I had ruby-1.8 and ruby-1.9
> > > > installed but removed them and the problem still persists.
> > > > > 2. It seems that there are some issues with oci8 installation if you
> > > > > got "no such file to load" issue. Have you compiled and installed ruby-
> > > > > oci8 library or have you installed it with "gem install ruby-oci8"?
> > > > > If you have installed as gem then try
> > > > > require ‘rubygems’
> > > > > gem ‘ruby-oci8’
> > > > > require 'oci8'
> > > > > OCI8.new('user', 'password', 'database').exec('select * from dual') do
> > > > > |r| puts r.join(','); end
> > > > > if successful it sho1uld return X from this select.
> > > > > and see if it is successful (use your correct database, username and
> > > > > password)
> > > > > As I understand your previous post is related to the same issue?
> > > > not really (as far as I understand), Rails was complaining about that.
> > > > To work it around I installed the gem in the Rails tree (using rails
> > > > 2.2.0 and rake gems:install) and added the definition as outlined in
> > > > my previous post.
<raimonds.simanovs...@gmail.com> wrote:
> OK, so it seems that all the components (ruby-oci8 and
> oracle_enahnced) are working.
> Then the question about your environment.rb. I use the following line
> there:
> config.gem "activerecord-oracle_enhanced-adapter", :lib =>
> "active_record/connection_adapters/oracle_enhanced_adapter"
this did it! my bad for not looking more carefully at the :lib option.
> In addition I am also using ruby-plsql gem and have the following line
> in environment.rb:
> config.gem "ruby-plsql", :lib => "ruby_plsql"
> oracle_enhanced tries to require ruby-plsql library as well but if it
> is missing then it should work also without it.
> But maybe you can try to install ruby-plsql gem as well and include it
> in your environment.rb file.
I don't have ruby-plsql and as expected ruby-oci8 is doing just fine.
> Recently I found that you can also use envvars file for setting Apache
> environment variables but somehow it does not work anymore on my Mac
> (the file is /usr/sbin/envvars and it is executed in apachectl
> script). If anyone knows what could be the issue I would like to hear
> it.
Just for the record, Debian has /etc/apache2/envvars which is sourced
in all the apache system scripts