Detailed description of oracle installation and database connection methods

Source: Internet
Author: User
Tags builtin
This article mainly introduces how to install oracle extension and database connection in python, and analyzes in detail the installation steps, operating skills, and precautions for downloading oracle extensions in Python and Windows and Linux environments, for more information about how to install oracle extension and database connection in python, the installation steps, operating skills, and precautions for downloading oracle extensions in Python and Windows and Linux are analyzed in detail. For more information, see

This example describes how to install oracle extension and database connection in python. We will share this with you for your reference. The details are as follows:

Download:

Cx_Oracle: cx-oracle.sourceforge.net/
Instantclient-basic: www.oracle.com/technetwork/database/features/instant-client/index-097480.html

Window environment:

Python27 oracle10

Software required:

Cx_Oracle-5.1.2-10g.win32-py2.7.msi
Instantclient-basic-win32-10.2.0.4.zip

1. double-click the msi file to install cx_Oracle;

2. decompress instantclient-basic-win32-10.2.0.4.zip and copy all the. dll files to the F: \ Python27 \ Lib \ site-packages directory.

Linux environment:

Python26 orracle10

Software required:

Cx_Oracle-5.1.2-10g-py26-1.x86_64.rpm
Basic-10.2.0.4.0-linux-x86_64.zip

1. rps-ivh cx_Oracle-5.1.2-10g-py26-1.x86_64.rpm
2. (For more information, see www.jb51.net/article/424295.htm)

Set environment variables

vi /root/.bash_profile

Add the following two rows:

export ORACLE_HOME=/usr/local/instantclient_10_2export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME

Run source/root/. bash_profile to make the change take effect.

Create a symbolic link for this link Library

cd $ORACLE_HOMEln -s libclntsh.so.x.x libclntsh.so

Reinstall cx_Oracle

Note that the -- nodeps parameter is added. Otherwise, the above error will be reported.

[Root @ BJ-UPDATE-01 ~] # Rpm-ivh -- nodeps cx_Oracle-5.0.1-10g-py24-1.x86_64.rpm.
# Skip -- nodeps parameter for 5.0.3

Test:

#Python>>> import cx_Oracle>>> db = cx_Oracle.connect('user/psw@114.242.113.91:1521/orcl')>>> print db
 
  >>> cr=db.cursor()>>> cr.execute("select * from LOGININFO")
  
   >>>> rs=cr.fetchall()>>> print rs[('40288a8542746fd90142746fdbb50001', 'cccccc', 1, 1, None, None, None), ('40288a85427474b601427474b8270001', 'eeee', 1, 1, None, None, None), ('40288a854273bce0014273bee6310002', 'dddddd', 0, 0, None, None, None), ('40288a854274532d014274532f600001', 'cccccc', 1, 1, None, None, None), ('40288a8542747c750142747c77ac0001', 'eeee', 1, 1, None, None, None), ('40288a8542744fb30142744fb5e90001', 'cccccc', 1, 1, None, None, None)]>>>
  
 

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.