Ibm Data Server Driver For Jdbc And Sqlj Support For Ssl - IBM DB2 Manual

Table of Contents

Advertisement

IBM Data Server Driver for JDBC and SQLJ support for SSL

|
|
|
|
|
|
|
|
|
|
|
|
|
|
458
Application Programming Guide and Reference for Java
String user = "user";
String password = "password";
// Call getDB2TrustedPooledConnection to get the trusted connection
// instance and the cookie for the connection
Object[] objects = dataSource.getDB2TrustedPooledConnection(
Example: Reuse an existing trusted connection:
// The first item that was obtained from the previous getDB2TrustedPooledConnection
// call is a connection object. Cast it to a PooledConnection object.
javax.sql.PooledConnection pooledCon =
(javax.sql.PooledConnection)objects[0];
properties = new java.util.Properties();
// Set new properties for the reused object using
// properties.put("property", "value");
// The second item that was obtained from the previous getDB2TrustedPooledConnection
// call is the cookie for the connection. Cast it as a byte array.
byte[] cookie = ((byte[])(objects[1]);
// Supply the user ID for the new connection.
String newuser = "newuser";
// Supply the name of a mapping service that maps a workstation user
// ID to a z/OS RACF ID
String userRegistry = "registry";
// Do not supply any security token data to be traced.
byte[] userSecTkn = null;
// Do not supply a previous user ID.
String originalUser = null;
// Call getDB2Connection to get the connection object for the new
// user.
java.sql.Connection con =
((com.ibm.db2.jcc.DB2PooledConnection)pooledCon).getDB2Connection(
cookie,newuser,password,userRegistry,userSecTkn,originalUser,properties);
Related tasks
"Connecting to a data source using the DataSource interface" on page 15
"Connecting to a data source using the DriverManager interface with the IBM
Data Server Driver for JDBC and SQLJ" on page 11
"Creating and deploying DataSource objects" on page 19
Related reference
"Properties for the IBM Data Server Driver for JDBC and SQLJ" on page 201
The IBM Data Server Driver for JDBC and SQLJ provides support for the Secure
Sockets Layer (SSL) through the Java Secure Socket Extension (JSSE).
You can use SSL support in your Java applications if you use IBM Data Server
Driver for JDBC and SQLJ type 4 connectivity to DB2 for z/OS Version 7 or later,
to DB2 Database for Linux, UNIX, and Windows Version 9.1, Fix Pack 2 or later, or
to IBM Informix Dynamic Server (IDS) Version 11.50 or later.
To use SSL connections, you need to:
v Configure connections to the data source to use SSL.
v Configure your Java Runtime Environment to use SSL.
Related tasks
"Connecting to a data source using the DataSource interface" on page 15
"Connecting to a data source using the DriverManager interface with the IBM
Data Server Driver for JDBC and SQLJ" on page 11
user,password, properties);

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents