Friday, April 17, 2009

Building Ruby on Rails with Oracle Instantclient

- build ruby, gem, rails as per
build ruby
build gem
use gem to install rails
- get instantclient

note: build against this, ok to run against the .so's in /usr/lib
- on mac, make this link
cd .../instantclient_10_2
ln -s libclntsh.dylib.10.1 libclntsh.dylib
- build ruby-oci8 from
export DYLD_LIBRARY_PATH=.../instantclient_10_2
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install
- test (this is on one line)
ruby -r oci8 -e "'nm/pass@db').exec('select * from user_tables') do |r| puts r.join(','); end"
- Install the activerecord-oracle_enhanced-adapter gem, NOT, as many pages out-of-dately specify, activerecord-oracle-adapter
gem install activerecord-oracle_enhanced-adapter
adapter: oracle_enhanced
database: orcl # or, host:
username: scott
password: tiger
- do that sweet rails thing:
rails mhtest
cd mhtest
ruby script/generate scaffold comic title:string issue:integer publisher:string
rake db:migrate
ruby script/server
- hooray, it works
- references: