Python3.6 connect to Oracle databases

First, prepare the environment

We need the following environment (My Computer environment: Before connecting the Oracle database windows 10 64 Wei ):

1, python version: python3.6 64 Wei

2、cx_Oracle的版本:cx_Oracle-5.3-11g.win-amd64-py3.6-2.exe

3、Oracle客户端的版本:instantclient-basic-windows.x64-11.2.0.4.0

 

1、python

python environment is omitted here, python python version installed to view by cmd command

 

It should be noted that the following frame lines corresponding to the same color to the same:

 

 

 2、cx_Oracle

 cx_Oracle的下载地址 https://pypi.org/project/cx-Oracle/5.3/#files

 

 

 After the download is completed in accordance with the guidelines can be installed

 

3, Oracle client

Download Oracle client   https://www.oracle.com/database/technologies/instant-client/downloads.html

 

 

 

 

 

 Once downloaded, unpack the archive. then复制oci.dll,oraocci11.dll,oraociei11.dll三个文件,粘贴至Python目录的Lib/site-packages文件夹下面。(这样就不需要配置环境变量)

 

Second, test the connection

When ready the above environment, the next step is to test the connection Oracle database friends ~

1, open pycharm, a new python file

2, write test code (import cx_Oracle not an error, it indicates that the installation was successful cx_Oracle)

 

 After running the code, check out the discovery of Chinese are garbled, following is the solution:

 

 

 It can be seen Chinese shows the normal ~ ~ ~

 

Guess you like

Origin www.cnblogs.com/yudx/p/11527390.html