麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 開發(fā) > Python > 正文

python使用 cx

2024-09-09 19:03:02
字體:
供稿:網(wǎng)友

本文實(shí)例講述了python使用 cx_Oracle 模塊進(jìn)行查詢操作。分享給大家供大家參考,具體如下:

# !/usr/bin/env python# -*- coding: utf-8 -*-import cx_Oraclefrom pprint import pprintimport csvimport timeimport reimport binasciiprint time.ctime()try: conn = cx_Oracle.connect('tlcbuser/[email protected]/tlyy')# cursor = conn.cursor()# xsql="select * from tlcb_mon_device a where a.ipaddr='10.3.244.1'"# r = cursor.execute(xsql)# print rexcept Exception,e: print e print type(e) print str(e).decode('UTF-8').encode('GBK') print time.ctime()

C:/Python27/python.exe C:/Users/tlcb/PycharmProjects/untitled/a6.py
Mon Oct 22 10:35:59 2018
ORA-12170: TNS: ���ӳ�ʱ
<class 'cx_Oracle.DatabaseError'>
Mon Oct 22 10:36:20 2018
 
Process finished with exit code 0

# !/usr/bin/env python# -*- coding: utf-8 -*-import cx_Oraclefrom pprint import pprintimport csvimport timeimport reimport binasciiimport osos.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'print time.ctime()try: conn = cx_Oracle.connect('tlcbuser/[email protected]/tlyy')# cursor = conn.cursor()# xsql="select * from tlcb_mon_device a where a.ipaddr='10.3.244.1'"# r = cursor.execute(xsql)# print rexcept Exception,e: print e print type(e) print time.ctime()

C:/Python27/python.exe C:/Users/tlcb/PycharmProjects/untitled/a6.py
Mon Oct 22 10:44:20 2018
ORA-12170: TNS: 連接超時(shí)
<class 'cx_Oracle.DatabaseError'>
Mon Oct 22 10:44:41 2018
 
Process finished with exit code 0

# !/usr/bin/env python# -*- coding: utf-8 -*-import cx_Oraclefrom pprint import pprintimport csvimport timeimport reimport binasciiimport osos.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'print time.ctime()conn = cx_Oracle.connect('test/[email protected]/serv')cursor = conn.cursor()xsql="select 'aaa' from dual"cursor.execute(xsql)result = cursor.fetchall()print result

C:/Python27/python.exe C:/Users/tlcb/PycharmProjects/untitled/rizhiyi/a7.py
Mon Oct 22 11:33:52 2018
[('aaa',)]
 
Process finished with exit code 0

更多關(guān)于Python相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Python常見數(shù)據(jù)庫操作技巧匯總》、《Python編碼操作技巧總結(jié)》、《Python數(shù)據(jù)結(jié)構(gòu)與算法教程》、《Python Socket編程技巧總結(jié)》、《Python函數(shù)使用技巧總結(jié)》、《Python字符串操作技巧匯總》、《Python入門與進(jìn)階經(jīng)典教程》及《Python文件與目錄操作技巧匯總》

希望本文所述對大家Python程序設(shè)計(jì)有所幫助。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 九九热视频免费在线观看 | 欧美性受ⅹ╳╳╳黑人a性爽 | 97精品视频在线观看 | 夜夜夜精品视频 | 欧美一级毛片免费观看 | 色淫影院| 国产 视频 一区二区 | 成人国产精品一区二区毛片在线 | 一本精品999爽爽久久久 | 成人免费观看在线视频 | 九九热色 | h色视频在线观看 | 国产精品一品二区三区四区18 | 成人国产精品一区二区毛片在线 | 一区二区三区日韩在线 | 欧美精品电影一区二区 | 成人福利视频导航 | 91精品国产九九九久久久亚洲 | 一级做a爱片性色毛片 | 国产精品久久久久永久免费 | 免费激情网站 | 国产污污视频 | 久久国产精品久久久久 | 在线成人免费网站 | 久久国产精品二区 | 爱福利视频网 | 欧美一级特黄特色大片免费 | 国产美女爽到喷白浆的 | 国产无区一区二区三麻豆 | 日本黄色免费观看视频 | 免费放黄网站在线播放 | 欧美性生视频 | 在线区| 国产亚洲精品综合一区91555 | 国产在线观看免费视频软件 | 免费国产在线观看 | 日产精品久久久一区二区福利 | 天天干导航 | 免费一级毛片电影 | 经典三级在线视频 | 亚洲网站免费看 |