Reputation: 3229
I am writing a Java Application in which I am connecting to a DB2 database and after getting the connection, I am setting the client info for that connection using the following code:
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"));
I am aware that I can get the client info using con.getClientInfo
, but is the client information stored in the database? According to the Java Documentation, the client information is stored in a suitable location in the database (for example in a special register, session parameter, or system table column). Is there an SQL statement which I can execute to see a list of all open connection?
Upvotes: 0
Views: 4048
Reputation: 3311
According to this you can get it from the special registers, here's an older topic that references the same thing.
Edited:
This is also a nice link that lists a number of useful statements dbForums
Upvotes: 1
Reputation: 109000
The support for getClientInfo
and the datastorage location is database dependent. You will need to check the driver and database documentation to find out how it is handled for you database / driver.
Upvotes: 1