【问题标题】:Ruby on Rails connection SQL Oracle problemsRuby on Rails 连接 SQL Oracle 问题
【发布时间】:2016-02-23 18:11:25
【问题描述】:

我正在尝试设置 SQL Oracle 并使用活动记录来迁移带有 ruby​​ on rails 的 db。 我安装了 sqldeveloper 并创建了一个新连接。这里是第一个错误:

I/O 错误:网络适配器无法建立连接

然后我安装了instantclient basic、sdk、sqlplus和两个gem:

gem 'ruby-oci8'

gem 'activerecord-oracle_enhanced-adapter'

但我收到了这个错误:

LoadError:无法加载“active_record/connection_adapters/oracle_adapter”。确保 config/database.yml 中的适配器有效。如果您使用“mysql”、“mysql2”、“postgresql”或“sqlite3”以外的适配器,请将必要的适配器 gem 添加到 Gemfile。

这是我的 database.yml:

# SQLite version 3.x

#   gem install sqlite3

#

#   Ensure the SQLite 3 gem is defined in your Gemfile

#   gem 'sqlite3'

#

development: 

adapter: oracle 

database: development 

username: nick 

password: 


# Warning: The database defined as "test" will be erased and 

# re-generated from your development database when you run "rake". 

# Do not set this db to the same as development or production. 

test: 

adapter: oracle 

database: test 

username: nick 

password: 


production: 

adapter: oracle 

database: production  

username: nick 

password:

我无法找到解决方案,我该怎么办?

【问题讨论】:

    标签: sql ruby oracle ruby-on-rails-4 ubuntu


    【解决方案1】:

    更新adapter条目如下:

    adapter: oracle adapter: oracle_enhanced

    【讨论】:

    • 这是新日志:警告:未设置 NLS_LANG。回退到 US7ASCII。耙中止! OCIError: ORA-12170: TNS: Connect timeout occurred oci8.c:654:in oci8lib_210.so
    • 我认为您需要在连接 sqlplus 用户/密码@数据库时编辑 database 值。你也可以参考这个自述文件。 github.com/rsim/oracle-enhanced/blob/master/README.md
    • 真正的问题是错误I/O 错误:网络适配器无法建立连接。我找不到解决方案...
    猜你喜欢
    • 1970-01-01
    • 2011-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-30
    • 2011-05-10
    相关资源
    最近更新 更多