結合使用 Oracle 和 Ruby on Rails 的補充

本文是對此文的補充:

結合使用 Oracle 和 Ruby on Railshtml

http://www.oracle.com/technetwork/cn/tutorials/rubyrails-095981-zhs.html#t2sql

 

一、ORACLEXE 下載:數據庫

http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.htmlexpress

默認安裝,記下sys system 密碼 yulikeruby

安裝 instantclient服務器

instantclient-basic-nt-12.1.0.1.0.zip
instantclient-jdbc-nt-12.1.0.1.0.zip
instantclient-odbc-nt-12.1.0.1.0.zip
instantclient-sdk-nt-12.1.0.1.0.zip
instantclient-sqlplus-nt-12.1.0.1.0.zip
instantclient-tools-nt-12.1.0.1.0.ziporacle

 

二、下載並解壓縮 rubyrails.tar 文件。運行壓縮包中的 setup_ruby_hol.sql 建立數據庫環境fetch

sqlplus sys/yulike@//127.0.0.1/XE as sysdbaui

@setup_ruby_hol.sqlthis

按照提示輸入:

SQL> @setup_ruby_hol.sql
Enter the Database Name ( Oracle SID):
//127.0.0.1/XE
Enter the DBA user:
sys
Enter the DBA password:
yulike
Enter the (new) user for this lab(user will be DROPPED and created):
hol_hr
Enter the password for the (new) user:
hol_hr

完成初始化。

sqlplus hol_hr/hol_hr@//127.0.0.1/XE

 

三、RUBY環境,隨便下個rubystack 便可。

而後還須要安裝ruby-oci8

gem sources --remove https://rubygems.org/
gem sources -a https://ruby.taobao.org/
gem sources -l

gem install ruby-oci8 

gem install activerecord-oracle_enhanced-adapter --prerelease

 (辦公室使用了代理服務器: gem install ruby-oci8 -p http://10.104.17.70:3398

 

四、對於ruby 1.9之後的版本,須要修改rubyrails.tar 壓縮包中全部rb文件中的requere  'config.rb' 爲 require_relative 'config.rb'

ALL WILL BE FINE!

d:\Workspaces\xe>ruby fetch.rb

================================================================================

ID,NAME
0.1E1,Europe
0.2E1,Americas
0.3E1,Asia
0.4E1,Middle East and Africa
--------------------------------------------------------------------------------

 

五、百度網盤分析,有全部須要的文件。

http://pan.baidu.com/s/1pJC8V3d

相關文章
相關標籤/搜索