Python3 access to Oracle database with Cx_oracle

Source: Internet
Author: User

Tags:close   print   md5    client    5.2.1     after completion     address     environment variable    sele   

1. Installing the Oracle Client Instantclient
Note that the installed version, I installed the instantclient_11_1 version of the installation of Instantclient_12_2 version of the time will be due to the system can not parse DLL error.
(1) After the download is complete, unzip to a directory, such as: E:\instantclient_11_1
(2) Add environment variables:
Tns_admin, with a value of E:\instantclient_11_1
Nls_lang, the value is simplified Chinese_china. ZHS16GBK, this is to prevent Chinese garbled
Create a listener file Tnsnames.ora to E:\instantclient_11_1
2, install the corresponding version of the Cx_oracle
(1) Here the Oracle client is version 11.1, Python is version 3.4, the operating system is 64-bit, so you need to download the (MD5) version of Cx_oracle
(2) Once the download is complete, double-click the installation directly
(3) After the installation is complete, copy all DLL files under the client (i.e.: E:\instantclient_11_1 directory) to the Python package directory, which is under the C:\Python34\Lib\site-packages folder
3. Use test
Import Cx_oracle
Print (Cx_oracle.clientversion ())
conn = Cx_oracle.connect ("User name/password @ server address/server name")
cursor = Conn.cursor ()
Cursor.execute ("Select address from temp_m_customer_addr_info where ID = ' 103791721 '")
row = Cursor.fetchone ()
Print (ROW)
Cursor.close ()
Conn.close ()

Python3 access to Oracle database with Cx_oracle

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: and provide relevant evidence. A staff member will contact you within 5 working days.

Tags Index: