Oracle을 실행하는 서버가 있습니다. IP는 192.168.1.50입니다.레일 애플리케이션을 Oracle에 연결할 수 없습니다.
내 리눅스 박스에이 오라클 서버에 연결해야합니다. 내가 오라클 인스턴트 클라이언트를 설치하고 그에 따라 환경 변수를 설정 :
OCI_INCLUDE_DIR =/홈/루크/instantclient_11_2/SDK/포함
LD_LIBRARY_PATH =/홈/루크/instantclient_11_2
DYLD_LIBRARY_PATH =/홈/루크/instantclient_11_2/
OCI_LIB_DIR =/홈/루크/instantclient_11_2
ORACLE_HOME =/홈/루크
는 또한 적절한 보석 설치/instantclient_11_2 :
ruby-oci8 (2.1.0)
,691,363을 (210)
나는 나의 모델을 정의하고 갈퀴 DB를 실행하면 :
rake aborted!
ORA-12154: TNS:could not resolve the connect identifier specified
oci8.c:360:in oci8lib_191.so
/home/luc/.rvm/gems/ruby-1.9.3-p125/gems/ruby-oci8-2.1.0/lib/oci8/oci8.rb:123:in `initialize'
/home/luc/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-oracle_enhanced-adapter-1.4.1/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb:319:in `new'
/home/luc/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-oracle_enhanced-adapter-1.4.1/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb:319:in `new_connection'
/home/luc/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-oracle_enhanced-adapter-1.4.1/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb:429:in `initialize'
/home/luc/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-oracle_enhanced-adapter-1.4.1/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb:24:in `new'
/home/luc/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-oracle_enhanced-adapter-1.4.1/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb:24:in `initialize'
/home/luc/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-oracle_enhanced-adapter-1.4.1/lib/active_record/connection_adapters/oracle_enhanced_connection.rb:9:in `new'
....
내 database.yml을은 다음과 같습니다 :
development:
adapter: oracle_enhanced
host: 192.168.1.50:1521/orcl
username: USER
password: PASS
SQLPLUS 연결하지만 완벽하게 작동합니다 :
를 나는 다음과 같은 오류 메시지를 받았습니다 마이그레이션sqlplus USER/[email protected]:1521/orcl
SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 21 17:34:26 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
이 conf에는 누락 된 항목이 있습니까?
UPDATE
내가 명령 줄에서 테스트 한 연결이 잘 작동 :
루비는 -e는 " 'OCI8'필요 -rubygems; OCI8.new ('사용자', 'PASS' . 끝을 "IRB에서
=> OK
같은 일을) ','(r.join을두고 | r은 |, '192.168.1.50/ORCL') 간부는 (할)이 '* 사용자의 선택' :
ActiveRecord::Base.establish_connection(:adapter => "oracle_enhanced", :database => "//192.168.1.50/orcl",:username => "USER",:password => "PASS")
=>
확인하지만 여전히 내 레일 응용 프로그램에서 작동하지 않습니다.development:
adapter: oracle_enhanced
database: //192.168.1.50:1521/orcl
username: USER
password: PASS
을; 호스트를 제거하면 문제가 해결되었습니다. – tamersalama