Access Oracle DB from Python

1. Install Instant Client Downloads for Linux x86-64

Download the following from Instant Client Downloads

After downloading, install the rpm package.

$ sudo rpm -ivh oracle-instantclient-basic-10.2.0.5-1.x86_64.rpm 
$ sudo rpm -ivh oracle-instantclient-devel-10.2.0.5-1.x86_64.rpm
$ sudo rpm -ivh oracle-instantclient-sqlplus-10.2.0.5-1.x86_64.rpm

2. Setting environment variables

2-1. Setting ORACLE_HOME

export ORACLE_HOME=/usr/lib/oracle/10.2.0.5/client64

2-2. PATH setting

export PATH=$PATH:$ORACLE_HOME/bin

2-3.include settings

sudo ln -s /usr/include/oracle/10.2.0.5/client64 /usr/lib/oracle/10.2.0.5/client64/include

2-4. ld settings

$ sudo vim /etc/ld.so.conf.d/oracle.conf

Write the following:

/usr/lib/oracle/10.2.0.5/client64/lib/

After saving, execute the following command

$ sudo /sbin/ldconfig

3. Install cx_Oracle

$ /usr/local/python2.7/bin/python setup.py build
$ sudo cp build/lib.linux-x86_64-2.7-10g/cx_Oracle.so /usr/local/python2.7/lib/python2.7/site-packages/

4. Check the connection

$ /usr/local/python2.7/bin/python
>>>import cx_Oracle
>>>

reference

Biased language followers

Recommended Posts

Access Oracle DB from Python
Access bitcoind from python
How to access wikipedia from python
Access spreadsheets using OAuth 2.0 from Python
Access Blender Shader Nodes from Python
Revived from "no internet access" in Python
sql from python
How to access RDS from Lambda (python)
MeCab from Python
[Python] Web application from 0! Hands-on (1) -Design, DB construction-
Touch MySQL from Python 3
Operate Filemaker from Python
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
Python from or import
Use MySQL from Python
Run python from excel
Install python from source
Execute command from Python
Operate neutron from Python!
[IBM Cloud] I tried to access the Db2 on Cloud table from Cloud Funtions (python)
Use MySQL from Python
Operate LXC from Python
Manipulate riak from python
Force Python from Fortran
Use BigQuery from python.
Execute command from python
[Python] Read From Stdin
Use mecab-ipadic-neologd from python
Get data from database via ODBC with Python (Access)
ODBC access to SQL Server from Linux with Python
Flatten using Python yield from
Call CPLEX from Python (DO cplex)
Post from Python to Slack
Cheating from PHP to Python
Make MeCab available from Python3
Information obtained from tweet_id (Python)
Run illustrator script from python
Use MySQL from Anaconda (python)
Anaconda updated from 4.2.0 to 4.3.0 (python3.5 updated to python3.6)
Study from Python Hour4: Object-oriented ②
Query Athena from Lambda Python
Study from Python Hour3: Functions
(For myself) Flask_6 (Open db from python, Mysql basic (phpMyAdmin))
Start / stop GCE from python
Stop Omxplayer from Python code
Switch from python2.7 to python3.6 (centos7)
Connect to sqlite from python
Install pyenv from Homebrew, install Python from pyenv
Study from Python Hour4: Object-oriented ①
Python naming convention (from PEP8)
Access Google Drive with Python
With skype, notify with skype from python!
Use e-Stat API from Python
Register redmine issue from Python
Call Matlab from Python to optimize
Execute Python script from batch file
Call a Python function from p5.js.
Python: Exclude tags from html data
Use Stanford Core NLP from Python
Try IAM Database Authentication from Python