steps
Oracle InstantClient installation
$ unzip instantclient-sqlplus-macosx-10.1.0.3.zip
$ cd instantclient10_1
$ ln -s libclntsh.dylib.10.1 libclntsh.dylib
$ ln -s libocci.dylib.10.1 libocci.dylib
$ cd..
$ sudo mkdir /usr/local/oracle
$ sudo mv instantclient10_1 /usr/local/oracle/instantclient10_1
$ sudo pico /etc/profile
(add)
#Oracle settings
ORACLE_HOME=”/usr/local/oracle”
export ORACLE_HOME
DYLD_LIBRARY_PATH=”/usr/local/oracle/instantclient10_1″
export DYLD_LIBRARY_PATH
SQLPATH=”/usr/local/oracle/instantclient10_1″
export SQLPATH
export PATH=”$PATH:/usr/local/oracle/instantclient10_1″
$ source /etc/profile
$ sqlplus
$ sudo mkdir -p /b/729/rdbms/lib/
$ sudo ln -s /usr/local/oracle/instantclient10_1/libclntsh.dylib.10.1 /b/729/rdbms/lib/libclntsh.dylib.10.1
cx_Oracle installation
$ cd cx_Oracle-4.2/
$ sudo python setup.py build
$ sudo python setup.py install
Important link:
From: http://pedro.emanuel.familiasalgado.org/?p=103
1 使用正确的环境编译MySQL-python-1.2.3.tar.gz,并安装
设置.bash_profile
1 | PATH= "/usr/local/mysql/bin:${PATH}" |
2 | export PATH |
3 | export DYLD_LIBRARY_PATH=/usr/ local /mysql/lib/ |
4 | export VERSIONER_PYTHON_PREFER_64_BIT= yes |
5 | export VERSIONER_PYTHON_PREFER_32_BIT=no |
2 编译安装cx_Oracle lib
1 | ARCHFLAGS= "-arch x86_64" python setup.py build #64bit使用这个 |
2 | ARCHFLAGS= "-arch i386" python setup.py build#32bit使用这个 |
3 |
4 | sudo python setup.py install |
3 开发环境IDE里设置DYLD_LIBRARY_PATH
1 | export DYLD_LIBRARY_PATH=/usr/ local /oracle/lib/ |
Oracle's instantclient installation instructions specify that the user set DYLD_LIBRARY_PATH. This is very troublesome to manage for multiple users.
To use the instantclient without setting any environment variables:
Download the instantclient distribution from oracle.com. For doing non-java software development, you will need (assuming Oracle 10.2):
instantclient-basic-macosx-10.2.0.4.0.zip
instantclient-sdk-macosx-10.2.0.4.0.zip
instantclient-sqlplus-macosx-10.2.0.4.0.zip
Unzip the three files. This will give you a directory
instantclient_10_2/
Copy the files to /usr, which is one of the default places the dynamic loader searches.
sudo cp instantclient_10_2/sdk/include/*.h /usr/include
sudo cp instantclient_10_2/sqlplus /usr/bin
sudo cp instantclient_10_2/*.dylib /usr/lib
If you use tnsnames.ora, copy it to /etc, which is the default global place the oracle runtime searches.
sudo cp tnsnames.ora /etc
Test with
/usr/bin/sqlplus scott/tiger@myoracle