有可能使用
ibm_db_dbi.ibm_db.SQL_ATTR_INFO_PROGRAMNAME
连接属性
import ibm_db_dbi
db2ConnArgs = "DATABASE=%s;HOSTNAME=%s;PORT=%s;PROTOCOL=TCPIP;UID=%s;PWD=%s;" % ('SAMPLE', 'localhost', 50000, 'db2test', 'db2test')
db2ConnDict = {ibm_db_dbi.SQL_ATTR_CURRENT_SCHEMA:'SAMPLE', ibm_db_dbi.ibm_db.SQL_ATTR_INFO_PROGRAMNAME : 'luis_app'}
dbhandle = ibm_db_dbi.connect(db2ConnArgs,"", "","","",db2ConnDict)
跑
db2 list application
Auth Id Application Appl. Application Id DB # of
Name Handle Name Agents
-------- -------------- ---------- -------------------------------------------------------------- -------- -----
DB2TEST luis_app 31 127.0.0.1.34194.180529223939 SAMPLE 1