An error may occur during installation, and a message may be prompted that the following steps may be performed 2.1) sudoln-slibclntsh.dylib.10.1libclntsh.dylib2.2) to set up the environment
An error may occur during the installation process. Generally, a prompt is displayed, and the following step 2.1 may be executed.) sudo ln-s libclntsh. dylib.10.1 libclntsh. dylib 2.2) sets the environment.
Preparations:
1) install ActiveRecord Oracle adapter
Sudo gem install activerecord-oracle-adapter -- source
2) install the Oracle Client
An error may occur during the installation process. Generally, a prompt is displayed, and the following steps may be performed:
2.1) sudo ln-s libclntsh. dylib.10.1 libclntsh. dylib
2.2) set the environment variable. You can add it in. profile for Mac.
Export DYLD_LIBRARY_PATH = "/usr/local/oracle/instantclient_10_2"
3) install the ruby oracle driver and modify the driver according to your system environment.
Sudo env DYLD_LIBRARY_PATH = $ DYLD_LIBRARY_PATH ARCHFLAGS = "-arch x86_64" gem install ruby-oci8
For installation instructions, refer to the following article:
The project requires the Rails application to connect to mysql and Oracle DB at the same time, so you only need to modify the configuration in the config/database. yml file:
The following configuration generally uses the 'development' configuration by default and connects to the sqlite3 database.
Development:
Adapter: sqlite3
Database: db/development. sqlite3
Pool: 5
Timeout: 5000
Iisp:
Adapter: oracle
Encoding: utf8
Database: 192.168.68.22/iisp. xjgz
Username: iisp916
Password: iisp916
In iisp/database, the IP address is followed by the database Sid, not the database Name
Add the following code to the model to connect to oracle:
Establish_connection 'iisp'
Self. table_name = 't_ capacity'
Self. sequence_name ='s _ capacity '# primary key generation
Set the code for Rails to connect to Oracle:
Add the following code to config/environment. rb:
ENV ['nls _ lang'] = 'American _ AMERICA. utf8'