Skip to content

Instantly share code, notes, and snippets.

@Xifeng2009
Created January 8, 2019 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xifeng2009/269bb59ccea8f07bfee03668a8fec8f3 to your computer and use it in GitHub Desktop.
Save Xifeng2009/269bb59ccea8f07bfee03668a8fec8f3 to your computer and use it in GitHub Desktop.
import cx_Oracle #引用模块cx_Oracle
conn=cx_Oracle.connect('load/123456@localhost/ora11g') #连接数据库
c=conn.cursor() #获取cursor
x=c.execute('select sysdate from dual') #使用cursor进行各种操作
x.fetchone()
c.close() #关闭cursor
conn.close() #关闭连接
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment