我写一个Java应用程序中,我连接到DB2数据库,并获得连接后,我使用下面的代码设置该连接的客户端信息:SQL连接ClientInfo客户端
String clientprogname = "MY PROGRAM"; //Progname
String clientname = "user1"; // The name of the End-User
con.setClientInfo("ApplicationName", clientprogname);
con.setClientInfo("ClientUser", clientname);
con.prepareStatement("SELECT * FROM SYSIBM.SYSDUMMY1 WHERE 0 = 1").executeQuery();
// Execute SQL to force extended client information to be sent to the server
LogFile.log("ApplicationName: " + con.getClientInfo("ApplicationName"));
LogFile.log("ClientUser: " + con.getClientInfo("ClientUser"));
我意识到我可以使用con.getClientInfo
获取客户端信息,但客户端信息是否存储在数据库中?根据Java Documentation,客户端信息存储在数据库中的适当位置(例如,在特殊的寄存器,会话参数或系统表列中)。是否有SQL语句可以执行以查看所有打开的连接的列表?
在DB2 9.7上:从SYSIBMADM.APPLICATIONS中选择substr(APPL_NAME,1,30) – Mike