1. Download and install the Cx_oracle installation package
Python Operations Oracle database, the first need to 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 series operating system, Python version is 2.4, so download support python2.4 version of the installation package.
2. Download the Oracle client, which is the official Oracle website.
Download the corresponding Oracle version of the installation package for the Linux x64 version.
oracle-instantclient-basic-10.2.0.5-1.x86_64.rpm
650) this.width=650; "style=" border-bottom:0px;border-left:0px;border-top:0px;border-right:0px; "title=" image " Border= "0" alt= "image" Src= "Http://img1.51cto.com/attachment/201407/9/703525_1404917435oqkv.png" height= "214"/ >
3. Configuring 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
650) this.width=650; "style=" border-bottom:0px;border-left:0px;border-top:0px;border-right:0px; "title=" image " Border= "0" alt= "image" Src= "Http://img1.51cto.com/attachment/201407/9/703525_1404917438S1UV.png" height= "219"/ > 4. Test python Connect Oracle
#!/usr/bin/python
Import Cx_oracle
conn = Cx_oracle.connect (' System/[email protected]:1521/orcl ')
Print Conn.version
cursor = Conn.cursor ()
Conn.close ()
The results of the implementation are as follows:
650) this.width=650; "style=" border-bottom:0px;border-left:0px;border-top:0px;border-right:0px; "title=" image " Border= "0" alt= "image" Src= "Http://img1.51cto.com/attachment/201407/9/703525_1404917438MNYm.png" height= "+"/>
This article is from the "Koumm Linux Technology blog" blog, make sure to keep this source http://koumm.blog.51cto.com/703525/1436501