Configure the Oracle database environment using Python
1. download and install the cx_Oracle installation package
To operate the Oracle database using Python, you must first install the cx_Oracle package as follows:
Http://cx-oracle.sourceforge.net/
Http://sourceforge.net/projects/cx-oracle/files/5.1.2/
The system uses the CentOS5.x operating system and python version 2.4. Therefore, download the installation package that supports python.
2. Download the oracle client from the official oracle website.
Download the installation package of the corresponding oracle version in linux x64.
Oracle-instantclient-basic-10.2.0.5-1.x86_64.rpm
3. configure system environment variables
# Vi. bash_profile
Export LD_LIBRARY_PATH =$ {LD_LIBRARY_PATH}:/usr/lib/oracle/10.2.0.5/client64/lib
# Source. bash_profile
4. Test python connection to oracle
#! /Usr/bin/python
Import cx_Oracle
Conn = cx_Oracle.connect ('System/oracle@192.168.1.101: 1521/orcl ')
Print conn. version
Cursor = conn. cursor ()
Conn. close ()
The execution result is as follows:
Python core programming version 2. (Wesley J. Chun). [Chinese version of hd pdf]
Python development technology details. (Zhou Wei, Zong Jie). [hd PDF scan version + book guide video + code]
Obtain Linux information using a Python script
Build a desktop algorithm transaction research environment using Python in Ubuntu
Python details: click here
Python: click here