Configure the Oracle database environment using Python

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.