IBM DB2 Manual page 468

Table of Contents

Advertisement

|
|
|
|
452
Application Programming Guide and Reference for Java
ENCRYPTED_USER_AND_DATA_SECURITY or
ENCRYPTED_USER_PASSWORD_AND_DATA_SECURITY securityMechanism value.
ENCRYPTED_USER_AND_DATA_SECURITY is valid for connections to DB2 for z/OS
servers only, and only for DES encryption (encryptionAlgorithm value of 1).
DB2 for z/OS or DB2 Database for Linux, UNIX, and Windows database servers
encrypt the following data when you specify encryption of security-sensitive data:
v SQL statements that are being prepared, executed, or bound into a package
v Input and output parameter information
v Result sets
v LOB data
v XML data
v Results of describe operations
Before you can use encrypted security-sensitive data, the z/OS Integrated
Cryptographic Services Facility needs to be installed and enabled on the z/OS
operating system.
To specify encrypted user ID or encrypted password security for a JDBC
connection, use one of the following techniques.
For the DriverManager interface: Set the user ID, password, and security
mechanism by setting the user, password, and securityMechanism properties in a
Properties object, and then invoking the form of the getConnection method that
includes the Properties object as a parameter. For example, use code like this to
set the user ID and encrypted password security mechanism:
import java.sql.*;
import com.ibm.db2.jcc.*;
...
Properties properties = new Properties(); // Create a Properties object
properties.put("user", "dbadm");
properties.put("password", "dbadm");
properties.put("securityMechanism",
new String("" + com.ibm.db2.jcc.DB2BaseDataSource.ENCRYPTED_PASSWORD_SECURITY +
""));
String url = "jdbc:db2://mvs1.sj.ibm.com:5021/san_jose";
Connection con = DriverManager.getConnection(url, properties);
For the DataSource interface: If you create and deploy the DataSource object, you
can set the user ID, password, and security mechanism by invoking the
DataSource.setUser, DataSource.setPassword, and
DataSource.setSecurityMechanism methods after you create the DataSource object.
For example, use code like this to set the encrypted user ID and encrypted
password security mechanism:
import java.sql.*;
import com.ibm.db2.jcc.*;
...
com.ibm.db2.jcc.DB2SimpleDataSource ds =
new com.ibm.db2.jcc.DB2SimpleDataSource();
ds.setDriverType(4);
ds.setDatabaseName("san_jose");
ds.setServerName("mvs1.sj.ibm.com");
// JDBC base
// IBM Data Server Driver for JDBC
// and SQLJ implementation of JDBC
// Set user ID for the connection
// Set password for the connection
// Set security mechanism to
// user ID and encrypted password
// Set URL for the data source
// Create the connection
// JDBC base
// IBM Data Server Driver for JDBC
// and SQLJ implementation of JDBC
// Create the DataSource object
// Set the driver type
// Set the location
// Set the server name

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents