execute ( my_sql ) except Exception as err : print ( "Error on Execute", err ) try : my_tables = my_cursor. exit ( 1 ) if hdbi : print ( "connected" ) # - # Query 1 # - print ( " \n Query1 begin" ) my_sql = """select distinct tabschema, tabname from syscat.tables where tabschema = 'DB2INST1' """ my_cursor = hdbi. Error as err : print ( "connection error:", err ) sys. Warning as warn : print ( "Connection warning:", warn ) except ibm_db_dbi. connect ( connect_string, host = hostname, database = database, user = userid, password = password, conn_options = connect_options ) except ibm_db_dbi. """ Example program using IBM_DB against Db2""" import os import sys import getpass import platform import ibm_db # - # Database Connection Settings # - database = "sample" hostname = "modi" userid = "db2inst1" password = "mypasswd" port = 50000 connect_string = "DRIVER= # - hdbi = None # Connection Object # - try : hdbi = ibm_db_dbi.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |