Getting "Connection not open" error in my rails application

Hi Guys,

I am a Perl developer and new to Ruby on Rails . Recently, I have setup a new rails application ( Ruby 2.4.0 and Rails 5.0.2 ) . When I launch the application after starting rails server , it generates an error “ORA-06413: Connection not open” . I am using ruby-oci8 (2.2.3) and activerecord-oracle_enhanced-adapter (1.7.9) and oracle client ( 10.1.0 ) . I have also set ORACLE_HOME , LD_LIBRARY_PATH , TNS_ADMIN environment variables in .bash_profile . I am getting below error ;

ORA-06413: Connection not open.

Rails.root: /home/akhand/work_space/test_app Application Trace | Framework Trace | Full Trace

oci8.c:654:in oci8lib_240.so ruby-oci8 (2.2.3) lib/oci8/oci8.rb:142:in initialize' activerecord-oracle_enhanced-adapter (1.7.9) lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:346:innew’ activerecord-oracle_enhanced-adapter (1.7.9) lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:346:in new_connection' activerecord-oracle_enhanced-adapter (1.7.9) lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:405:ininitialize’ activerecord-oracle_enhanced-adapter (1.7.9) lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:24:in new' activerecord-oracle_enhanced-adapter (1.7.9) lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:24:ininitialize’ activerecord-oracle_enhanced-adapter (1.7.9) lib/active_record/connection_adapters/oracle_enhanced/connection.rb:8:in new' activerecord-oracle_enhanced-adapter (1.7.9) lib/active_record/connection_adapters/oracle_enhanced/connection.rb:8:increate’ activerecord-oracle_enhanced-adapter (1.7.9) lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:169:in oracle_enhanced_connection' activerecord (5.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:729:innew_connection’ activerecord (5.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:773:in checkout_new_connection' activerecord (5.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:752:intry_to_checkout_new_connection’

I have configured database.yml and tnsnames.ora correctly but not sure why I am getting this error . Is Oracle 10 is the reason for this error ? Please suggest . FYI , I am able to connect and fetch result of SQL queries manually through the terminal using below command ;

ruby -r oci8 -e “OCI8.new(‘user’, ‘password’, ‘//databasehost:1521/testdb’).exec(‘SELECT * FROM application_account’) do |r| puts r.join(’ | '); end”

But not sure why it’s creating problem at rails app level . I tried all the solutions that I found on google but none of them worked .

Regards,

Akhand