EasyManuals Logo

IBM DB2 User Manual

IBM DB2
585 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #79 background imageLoading...
Page #79 background image
Client info properties support by the IBM Data Server Driver for
JDBC and SQLJ
JDBC 4.0 includes client info properties, which contain information about a
connection to a data source. The DatabaseMetaData.getClientInfoProperties
method returns a list of client info properties that the IBM Data Server Driver for
JDBC and SQLJ supports.
When you call DatabaseMetaData.getClientInfoProperties, a result set is returned
that contains the following columns:
v NAME
v MAX_LEN
v DEFAULT_VALUE
v DESCRIPTION
The following table lists the client info property values that the IBM Data Server
Driver for JDBC and SQLJ returns for DB2 Database for Linux, UNIX, and
Windows and for DB2 for i.
Table 11. Client info property values for DB2 Database for Linux, UNIX, and Windows and for DB2 for i
NAME MAX_LEN DEFAULT_VALUE DESCRIPTION
ApplicationName 255 Empty string The name of the application
that is currently using the
connection.
ClientAccountingInformation 255 Empty string The value of the accounting
string from the client
information that is specified for
the connection.
ClientHostname 255 The value that is set by
DB2Connection.setDB2ClientWorkstation.If
the value is not set, the default is the host
name of the local host.
The host name of the computer
on which the application that is
using the connection is running.
ClientUser 255 Empty string The name of the user on whose
behalf the application that is
using the connection is running.
public class ClientInfoTest {
public static void main(String[] args) {
String url = "jdbc:db2://sysmvs1.stl.ibm.com:5021/san_jose";
try {
Class.forName("com.ibm.db2.jcc.DB2Driver");
String user = "db2adm";
String password = "db2adm";
Connection conn = DriverManager.getConnection(url, 1
user, password);
conn.setClientInfo("ClientUser", "Michael L Thompson"); 2
conn.setClientInfo("ClientWorkstation, "sjwkstn1");
// Execute SQL to force extended client information to be sent
// to the server
conn.prepareStatement("SELECT * FROM SYSIBM.SYSDUMMY1"
+ "WHERE 0 = 1").executeQuery(); 3
} catch (Throwable e) {
e.printStackTrace();
}
}
}
Figure 21. Example of passing extended client information to a DB2 server
Chapter 3. JDBC application programming 63
|
|
|

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the IBM DB2 and is the answer not in the manual?

IBM DB2 Specifications

General IconGeneral
DeveloperIBM
Initial Release1983
LicenseProprietary
Written inC, C++
CategoryDatabase Management System (RDBMS)
Operating SystemLinux, Windows
Programming LanguagesC, C++
Data ModelsRelational
EditionsCommunity, Standard, Advanced
Key Featureshigh availability, scalability