An explanation of how Oracle installs and database connections

Source: Internet
Author: User
This article mainly describes the Python installation of Oracle extension and database connection method, a more detailed analysis of Python download Oracle extension and Windows, Linux environment installation procedures, operating skills and considerations, the need for friends can refer to the following

The examples in this article describe Python's installation of Oracle extensions and database connection methods. Share to everyone for your reference, as follows:

Download:

Cx_oracle Download Address: cx-oracle.sourceforge.net/
Instantclient-basic Download Address: 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. Directly double-click the MSI file, that is, install cx_oracle;

2. Unzip the Instantclient-basic-win32-10.2.0.4.zip and copy all the resulting. 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. RPM-IVH cx_oracle-5.1.2-10g-py26-1.x86_64.rpm
2. (Refer to www.jb51.net/article/106295.htm here)

Setting environment variables

Vi/root/.bash_profile

Add the following two lines:

Export Oracle_home=/usr/local/instantclient_10_2export ld_library_path= $LD _library_path: $ORACLE _home

Run Source/root/.bash_profile make changes take effect

Create a symbolic link to 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 error will be reported

[root@bj-update-01 ~]# RPM-IVH--nodeps cx_oracle-5.0.1-10g-py24-1.x86_64.rpm
#5. version 0.3 does not add--nodeps parameter

Test:

#Python >>> Import cx_oracle>>> db = Cx_oracle.connect (' USER/PSW@114.242.113.91:1521/ORCL ') > >> print db<cx_oracle.connection to user@114.242.113.91:1521/orcl>>>> cr=db.cursor () >> > Cr.execute ("SELECT * from Logininfo") <builtin. Oraclecursor on <cx_oracle.connection to user@114.242.113.91:1521/orcl>>>>> 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)]>>>

"Recommended"

1. Python Free video tutorial

2. Python Object-oriented video tutorial

3. Python Learning manual

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.