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

首頁 > 開發 > Python > 正文

python使用 cx

2024-09-09 19:03:00
字體:
來源:轉載
供稿:網友

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

# !/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: 連接超時
<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

更多關于Python相關內容感興趣的讀者可查看本站專題:《Python常見數據庫操作技巧匯總》、《Python編碼操作技巧總結》、《Python數據結構與算法教程》、《Python Socket編程技巧總結》、《Python函數使用技巧總結》、《Python字符串操作技巧匯總》、《Python入門與進階經典教程》及《Python文件與目錄操作技巧匯總》

希望本文所述對大家Python程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 国产亚洲欧美视频 | av电影在线免费观看 | 免费激情网址 | 亚洲精品一区中文字幕 | 羞羞的视频在线观看 | 韩国精品久久久 | 久久久一区二区三区四区 | 欧美日韩在线视频一区 | 在线观看国产一区二区三区 | 久草在线高清 | 激情亚洲一区二区三区 | 欧美特黄特色视频 | www视频免费在线观看 | 国产一有一级毛片视频 | 久久成人综合网 | 狠狠99 | 鲁丝一区二区二区四区 | 欧美一级片一区 | 黄视频网站免费 | 日韩激情 | 久久精品亚洲精品国产欧美kt∨ | 爱爱视频天天干 | 亚洲第一成人在线视频 | 国产98色| 黑色丝袜美美女被躁视频 | 欧美成人免费 | 爱唯侦察 国产合集 亚洲 | 国产成视频在线观看 | 中文字幕亚洲一区二区三区 | 成人区一区二区 | 国产精品麻豆一区二区三区 | 色污视频在线观看 | 1314成人网| av电影在线观看网址 | 成人毛片在线免费看 | 中文字幕在线不卡视频 | 91福利社在线 | 精品中文字幕视频 | 欧美一区二区三区不卡免费观看 | 国产免费片 | 青草久久av |