Digital Sanctum

Personal blog of Shane Witbeck Tags · Archive · About

Connecting to Oracle from Rails

Published: 01 Aug 2007

Since there are several variations of docs on this (some of which are out of date) I figured I’d document this.

  1. Download and install the Ruby interface from
  2. Then, in your config/database.yml file, you should have something like this:
  adapter: oracle
  database: SID
  host: //HOST:PORT
  username: YOURUSERNAME
  password: YOURPASSWORD

If you’re running Rails with JRuby you should have the Oracle JDBC drivers in the classpath and the entry above will be a little different:

common: &shared
   adapter: jdbc
   driver: oracle.jdbc.driver.OracleDriver
   url: jdbc:oracle:thin:@HOST:PORT:SID
   username: YOURUSERNAME
   password: YOURPASSWORD

# oracle (JDBC)
   <<: *shared
Tags: #oracle#oci#ruby-on-rails#ruby#database#yaml