windows under python oracle database connection

   

python oracle database connection method, as follows

1. First, the installation package cx_Oracle
2. Extract instantclient-basic-windows.x64-11.2.0.4.0.zip to c: \ oracle
3. Under all instantclient_11_2 .dll files to copy c: \ python34 \ Lib \ site -packages \ lower (python folder according to their respective versions are copied to the site-packages file)

python connected to the sample code:

  

# -*- coding: utf-8 -*-
import cx_Oracle

conn=cx_Oracle.connect('reporter','password','localhost:1521/ORCL')
cursor=conn.cursor()
sql="select * from test"
cursor.execute(sql)
data=cursor.fetchall()
print(data)
cursor.close()
conn.commit()
conn.close()

  

Guess you like

Origin www.cnblogs.com/68xi/p/11724030.html