से कनेक्ट नहीं कर सकता है मेरे पास ओरेकल चल रहा एक सर्वर है, आईपी 1 9 2.168.1.50 है।मेरे रेल ऐप को ओरेकल
मेरे लिनक्स बॉक्स पर, मुझे इस ओरेकल सर्वर से कनेक्ट करने की आवश्यकता है। मैं तो ओरेकल त्वरित ग्राहक स्थापित है और उसके अनुसार वातावरण चर सेट:
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)
एक बार मैं अपने मॉडल परिभाषित किया है और रेक 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 में कुछ याद आ रही है?
अद्यतन
मैं कमांड लाइन से परीक्षण किया है और कनेक्शन ठीक काम कर रहा है:
माणिक -rubygems -e " 'oci8' की आवश्यकता होती है; OCI8.new ('उपयोगकर्ता', 'पास' ।, '192.168.1.50/ORCL') कार्यकारी ('का चयन उपयोगकर्ताओं से *') कर | आर | डालता r.join (','); अंत "
=> ठीक
ही आईआरबी से बात :
ActiveRecord::Base.establish_connection(:adapter => "oracle_enhanced", :database => "//192.168.1.50/orcl",:username => "USER",:password => "PASS")
=> ठीक
लेकिन अभी भी अपने रेल app से काम नहीं कर रहा।
development:
adapter: oracle_enhanced
database: //192.168.1.50:1521/orcl
username: USER
password: PASS
मैं दोनों में परिभाषित किया गया था, मेजबान हटाने से इस मुद्दे को हल किया गया। – tamersalama