User Tools

Site Tools


tech:unix:ruby_on_rails_with_oracle

Configure ruby for oci8

download oci8 driver

download oci8 driver from http://rubyforge.org/projects/ruby-oci8 to /tmp

cd /tmp
tar zxvf ruby-oci8-0.1.12
cd ruby-oci8-0.1.12
make
make install

test with irb

/usr/bin/irb

irb(main):001:0> require 'oci8'
=> true
irb(main):002:0> exit

clean up

cd ..
rm -Rf ruby-oci8-0.1.12

Configure rails for oci8

set up your application

rails testapp

edit /testapp/config/database.yml

development:
  adapter: oci
  database: sys01
  host:
  username: rails_dev
  password:rails

# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test
  adapter: oci
  database: sys01
  host:
  username: rails_tst
  password: rails

production:
  adapter: oci
  database: sys01
  host:
  username: rails_prd
  password: rails

Create Oracle structures

CREATE TABLESPACE RAILS_DEV LOGGING DATAFILE '/u01/oradata/SYS01/rails_dev.dbf' SIZE 5M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

CREATE TABLESPACE RAILS_TST LOGGING DATAFILE '/u01/oradata/SYS01/rails_tst.dbf' SIZE 5M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

CREATE TABLESPACE RAILS_PRD LOGGING DATAFILE '/u01/oradata/SYS01/rails_prd.dbf' SIZE 5M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

create user rails_dev identified by rails default tablespace rails_dev;

create user rails_tst identified by rails default tablespace rails_tst;

create user rails_prd identified by rails default tablespace rails_prd;

grant connect, resource to rails_dev;

grant connect, resource to rails_tst;

grant connect, resource to rails_prd;

-- connect as rails_dev and "create sequence rails_sequence;"
-- connect as rails_tst and "create sequence rails_sequence;"
-- connect as rails_prd and "create sequence rails_sequence;"
tech/unix/ruby_on_rails_with_oracle.txt · Last modified: 2024/06/21 12:04 by 127.0.0.1