Providing Extended Client Information To The Data Source With Ibm Driver-Only Methods - IBM DB2 Manual

Table of Contents

Advertisement

Providing extended client information to the data source with
IBM driver-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.
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, 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.
Table 10. Methods that provide client information to the DB2 server
Method
setDB2ClientAccountingInformation
setDB2ClientApplicationInformation
setDB2ClientDebugInfo
setDB2ClientProgramId
setDB2ClientUser
setDB2ClientWorkstation
To set the extended client information, follow these steps:
1. Create a Connection.
2. Cast the java.sql.Connection object to a com.ibm.db2.jcc.DB2Connection.
3. Call any of the methods shown in Table 10.
4. Execute an SQL statement to cause the information to be sent to the DB2 server.
The following code performs the previous steps to pass a user name and a
workstation name to the DB2 server. The numbers to the right of selected
statements correspond to the previously-described steps.
Information provided
Accounting information
Name of the application that is working with
a connection
The CLIENT DEBUGINFO connection
attribute for the Unified debugger
A caller-specified string that helps the caller
identify which program is associated with a
particular SQL statement
User name for a connection
Client workstation name for a connection
Chapter 3. JDBC application programming
61

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents