Q:

Error trying to connect to Oracle from Rails on OS X

I went through all the steps described here to set up my OS X machine to allow me to connect to Oracle from a Rails app.
Set up the database.yml file in my app:
development:
  adapter: oracle_enhanced
  host: [SERVER IP ADDRESS]
  database: [ORACLE INSTANCE SID]
  username: xxx
  password: yyy
  encoding: utf8

Also tried it with the domain name.
Tried in Rails console...
>> con = ActiveRecord::Base.connection

But it hung for a long time then timed out with the error...
OCIError: ORA-12170: TNS:Connect timeout occurred
    from env.c:257:in oci8lib.so
    from /usr/local/lib/ruby/site_ruby/1.8/oci8.rb:229:in `initialize'
    from /usr/local/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.0/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb:184:in `new'
    from /usr/local/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.0/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb:184:in `new_connection'

[...]

Has anyone gotten this working on OS X and knows how to solve this?

A:

You should  have either the host: line or the database: line, but not both.
Use the database: line if you have a TNS entry.
database: orcl    ## orcl is an entry in tnsnames.ora

Otherwise use the host: format.
host: dbhost.example.com/orcl    # dbhost: network address of the database host
                                 # orcl: database instance name

More notes here:
How to configure Ruby on Rails with Oracle?

