Providing extended client information to the data source with IBM Data Server Driver for JDBC and SQLJ-only methods
A set of IBM Data Server Driver for JDBC and SQLJ-only methods provide extra information about the client to the server. This information can be used for accounting, workload management, or debugging.
About this task
Extended client information is sent to the database server when the application performs an action that accesses the server, such as executing SQL.
In the IBM Data Server Driver for JDBC and SQLJ version 4.0 or later, the IBM Data Server Driver for JDBC and SQLJ-only methods are deprecated. You should use java.sql.Connection.setClientInfo instead.
The IBM Data Server Driver for JDBC and SQLJ-only methods are listed in the following table.
Method | Information provided |
---|---|
setDB2ClientAccountingInformation | Accounting information |
setDB2ClientApplicationInformation | Name of the application that is working with a connection |
setDB2ClientDebugInfo | The CLIENT DEBUGINFO connection attribute for the Unified debugger |
setDB2ClientProgramId | A caller-specified string that helps the caller identify which program is associated with a particular SQL statement. setDB2ClientProgramId does not apply to Db2® on Linux®, UNIX, and Windows systems data servers. |
setDB2ClientUser | User name for a connection |
setDB2ClientWorkstation | Client workstation name for a connection |
Procedure
To set the extended client information, follow these steps:
- Create a Connection.
- Cast the java.sql.Connection object to a com.ibm.db2.jcc.DB2Connection.
- Call any of the methods shown in Table 1.
- Execute an SQL statement to cause the information to be sent to the data server.