import jaydebeapi import os import logging import time class Postgre_Person: def __init__(self): # 打开数据库连接 for i in range(10): try: url = ### user = ### password = #### dirver = 'com.informix.jdbc.IfxDriver' jarFile = "D:\\informix\ifxjdbc.jar" conn = jaydebeapi.connect(dirver, url, [user, password], jarFile) # 创建游标对象 self.curs = conn.cursor() logging.info('informix数据库连接成功') break except Exception as e: print("连接informixCB数据库异常!!!", "错误信息:", e) logging.info("连接informixCB数据库异常!!!", "错误信息:", e) return 0 # 查询数据() def Post_select(self): try: sql = ''' self.curs.execute(sql) list_count = self.curs.fetchall()return list_count except Exception as e: return 0
标签:语句,return,curs,python,self,informix,logging,import From: https://www.cnblogs.com/xujunhui/p/17346715.html