结合使用 Oracle 和 Ruby on Rails 的补充

本文是对此文的补充:

结合使用 Oracle 和 Ruby on Rails

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

1、ORACLEXE 下载:

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

默认安装,记下sys system 密码 yulike

安装 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.zip

2、下载并解压缩 rubyrails.tar 文件。运行压缩包中的 setup_ruby_hol.sql 创建数据库环境

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

@setup_ruby_hol.sql

按照提示输入:

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

3、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

4、对于ruby 1.9以后的版本,需要修改rubyrails.tar 压缩包中所有rb文件中的requere  'config.rb' 为 require_relative 'config.rb'

ALL WILL BE FINE!

d:Workspacesxe>ruby fetch.rb

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

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

5、百度网盘分析,有所有需要的文件。

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

原文地址:https://www.cnblogs.com/likeyu/p/4595957.html