linux下通过Instant Client访问oracle输出中文乱码的解决办法

1,设置NLS_LANG
  export NLS_LANG=american_america.AL32UTF8

2,在rails中database.yml的设置
  development:
  adapter: oracle
  database: XXX.XXX.XXX.XXX/service_name
  username: your_name
  password: your_password


3,测试oracle是否连通:
  ruby -r oci8 -e  "OCI8.new( 'your_name', 'your_password', 'XXX.XXX.XXX.XXX/service_name').exec( 'select * from your_table') do |r| puts r.join(' | '); end"

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