Hi, After a few days of struggling, I was able to run this command successfully. ruby -r oci8 -e "OCI8.new(''xxx_dba'', ''xxx'', ''//xxxx:1521/ xxxxx.xxx.org'').exec(''SELECT 1 from dual'') {|r| puts r.join}" I got "1.0" as output and I got my prompt back. So, I went back to the RoR app that I am working on, started WEBrick in Radrails but I got this error: ORA-12154: TNS:could not resolve the connect identifier specified RAILS_ROOT: ./script/../config/.. Application Trace | Framework Trace | Full Trace env.c:257:in oci8lib.so C:/web/IPSO/app/controllers/attending_ips_controller.rb:140:in `get_most_recent_record'' C:/web/IPSO/app/controllers/attending_ips_controller.rb:26:in `new_edit'' -e:4:in `load'' -e:4 C:/ruby_prod/lib/ruby/site_ruby/1.8/oci8.rb:229:in `initialize'' C:/ruby_prod/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/connection_adapters/oracle_adapter.rb:585:in `new'' C:/ruby_prod/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/connection_adapters/oracle_adapter.rb:585:in `new_connection'' C:/ruby_prod/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/connection_adapters/oracle_adapter.rb:621:in `initialize'' C:/ruby_prod/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/connection_adapters/oracle_adapter.rb:35:in `new'' C:/ruby_prod/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/connection_adapters/oracle_adapter.rb:35:in `oracle_connection'' C:/ruby_prod/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/connection_adapters/abstract/connection_specification.rb: 262:in `send'' C:/ruby_prod/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/connection_adapters/abstract/connection_specification.rb: 262:in `connection_without_query_cache='' C:/ruby_prod/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/query_cache.rb:54:in `connection='' C:/ruby_prod/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/connection_adapters/abstract/connection_specification.rb: 230:in `retrieve_connection'' C:/ruby_prod/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/connection_adapters/abstract/connection_specification.rb: 78:in `connection'' C:/ruby_prod/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/base.rb:427:in `find_by_sql'' C:/ruby_prod/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/base.rb:1101:in `send'' C:/ruby_prod/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/base.rb:1101:in `perform_action_without_filters'' C:/ruby_prod/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/filters.rb:696:in `call_filters'' C:/ruby_prod/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/filters.rb:688:in `perform_action_without_benchmark'' C:/ruby_prod/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/benchmarking.rb:66:in `perform_action_without_rescue'' C:/ruby_prod/lib/ruby/1.8/benchmark.rb:293:in `measure'' C:/ruby_prod/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/benchmarking.rb:66:in `perform_action_without_rescue'' C:/ruby_prod/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/rescue.rb:83:in `perform_action'' C:/ruby_prod/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/base.rb:435:in `send'' C:/ruby_prod/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/base.rb:435:in `process_without_filters'' C:/ruby_prod/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/filters.rb:684:in `process_without_session_management_support'' C:/ruby_prod/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/session_management.rb:114:in `process'' C:/ruby_prod/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/base.rb:334:in `process'' C:/ruby_prod/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/dispatcher.rb: 41:in `dispatch'' C:/ruby_prod/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/webrick_server.rb: 113:in `handle_dispatch'' C:/ruby_prod/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/webrick_server.rb: 79:in `service'' C:/ruby_prod/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' C:/ruby_prod/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' C:/ruby_prod/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' C:/ruby_prod/lib/ruby/1.8/webrick/server.rb:162:in `start'' C:/ruby_prod/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' C:/ruby_prod/lib/ruby/1.8/webrick/server.rb:95:in `start'' C:/ruby_prod/lib/ruby/1.8/webrick/server.rb:92:in `each'' C:/ruby_prod/lib/ruby/1.8/webrick/server.rb:92:in `start'' C:/ruby_prod/lib/ruby/1.8/webrick/server.rb:23:in `start'' C:/ruby_prod/lib/ruby/1.8/webrick/server.rb:82:in `start'' C:/ruby_prod/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/webrick_server.rb: 63:in `dispatch'' C:/ruby_prod/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/servers/ webrick.rb:59 C:/ruby_prod/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'' C:/ruby_prod/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'' C:/ruby_prod/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:495:in `require'' C:/ruby_prod/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:342:in `new_constants_in'' C:/ruby_prod/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:495:in `require'' C:/ruby_prod/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/server.rb: 39 C:/ruby_prod/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'' C:/ruby_prod/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'' script/server:3 env.c:257:in oci8lib.so C:/ruby_prod/lib/ruby/site_ruby/1.8/oci8.rb:229:in `initialize'' C:/ruby_prod/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/connection_adapters/oracle_adapter.rb:585:in `new'' C:/ruby_prod/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/connection_adapters/oracle_adapter.rb:585:in `new_connection'' C:/ruby_prod/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/connection_adapters/oracle_adapter.rb:621:in `initialize'' C:/ruby_prod/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/connection_adapters/oracle_adapter.rb:35:in `new'' ... ... does this mean my database.yml is not right? I am using exactly same database.yml compare to prod box. database.yml development: adapter: oracle database: //xxxx:1521/xxxxx.xxx.org username: xxxx_dba password: xxxx this setup is working fine in prod box that runs ruby 1.8.6, rails 2.1.0, and oracle instant client. The only difference that I can think of is that prod box runs mongrel as a windows service. am I missing something here? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Greg Clarke
2010-Apr-28 00:18 UTC
Re: "ORA-12154: TNS:..." error after successful oracle connection
kimda <tkkscf@...> writes: Hi kimda The TNS error message from Oracle suggests the problem is with your database string. But your ruby oci8 diagnostic looks good (providing all the x''s match) and I''ve checked here and a similar ruby oci8 connection string also works for me in Rails. (I usually rely on tnsnames.ora which is why I had to change my connection string to check.) However, I''m not running rails thru radrails - I''m using mongrel_rails from command line here. The only thing I can think of is that the process running radrails has some problem using or supplying the connection info to Oracle. Might be worth running rails from the command line in the same process that can successfully run the ruby oci8 command. regards Greg -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
kimda
2010-Apr-28 02:50 UTC
Re: "ORA-12154: TNS:..." error after successful oracle connection
Hi Greg, You were right! Running the server from command line solved my issue. thanks! Daniel On Apr 27, 8:18 pm, Greg Clarke <gregbcla...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> kimda <tkkscf@...> writes: > > Hi kimda > > The TNS error message from Oracle suggests the problem is with your > database string. > > But your ruby oci8 diagnostic looks good (providing all the x''s match) and > I''ve checked here and a similar ruby oci8 connection string also works for > me in Rails. (I usually rely on tnsnames.ora which is why I had to change > my connection string to check.) > > However, I''m not running rails thru radrails - I''m using mongrel_rails from > command line here. > > The only thing I can think of is that the process running radrails has some > problem using or supplying the connection info to Oracle. > > Might be worth running rails from the command line in the same process > that can successfully run the ruby oci8 command. > > regards > > Greg > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Greg Clarke
2010-Apr-28 04:20 UTC
Re: &quot;ORA-12154: TNS:...&quot; error after successful oracle connection
Glad to hear it kimda. Thanks for letting me know it worked. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Apparently Analagous Threads
- Problems connecting to remote Oracle DB on windows using active record
- ORA-12514: TNS:listener d oes not currently know of service requested in connect descriptor (OCIEr
- Problem with ActiveRecord, create, save, and Oracle adapter?
- Problem connection to oracle
- Rails AR/Oracle Unit Test: [7769] failed (getting worse)