rails2.1與Oracle 連結所需gem

ruby-oci8

http://rubyforge.org/frs/download.php/39148/ruby-oci8-1.0.2-i386-mswin32.gem

ruby-plsql:

http://rubyforge.org/frs/download.php/40169/ruby-plsql-0.2.1.gem

用於執行pl/sql procedure

conn = OCI8.new("hr","hr","xe")
cursor = conn.parse <<-EOS
BEGIN
  :return := test_uppercase(:p_string);
END;
EOS
cursor.bind_param(':p_string',"xxx",String)
cursor.bind_param(':return',nil,String,4000)
cursor.exec
puts cursor[':return']
cursor.close

you can do it much more simply:

plsql.connection = OCI8.new("hr","hr","xe")
puts plsql.test_uppercase('xxx')

Here are some more samples:

plsql.test_uppercase(:p_string => 'xxx')
plsql.hr.test_uppercase('xxx')
plsql.hr.test_package.test_uppercase('xxx')
plsql.test_copy("abc", nil, nil) # returns output arguments { :p_to => "abc", :p_to_double => "abcabc" }
 

ActiveRecord-oracle_enhanced

http://rubyforge.org/frs/download.php/40404/activerecord-oracle_enhanced-adapter-1.1.5.gem

In Rails config/database.yml file use oracle_enhanced as adapter name.

 

你可能感兴趣的:(oracle,PHP,Ruby,Rails,ActiveRecord)