Kerberos Security Under The Ibm Data Server Driver For Jdbc And Sqlj - IBM DB2 Manual

Table of Contents

Advertisement

ds.setPortNumber(5021);
ds.setUser("db2adm");
ds.setPassword("db2adm");
ds.setSecurityMechanism(
Kerberos security under the IBM Data Server Driver for JDBC and
SQLJ
JDBC support for Kerberos security is available for IBM Data Server Driver for
JDBC and SQLJ type 4 connectivity only.
To enable JDBC support for Kerberos security, you also need to enable the
following components of your software development kit (SDK) for Java:
v Java Cryptography Extension
v Java Generic Security Service (JGSS)
v Java Authentication and Authorization Service (JAAS)
See the documentation for your SDK for Java for information on how to enable
these components.
There are three ways to specify Kerberos security for a connection:
v With a user ID and password
v Without a user ID or password
v With a delegated credential
Kerberos security with a user ID and password
For this case, Kerberos uses the specified user ID and password to obtain a
ticket-granting ticket (TGT) that lets you authenticate to the database server.
You need to set the user, password, kerberosServerPrincipal, and
securityMechanism properties. Set the securityMechanism property to
com.ibm.db2.jcc.DB2BaseDataSource.KERBEROS_SECURITY (11). The
kerberosServerPrincipal property specifies the principal name that the database
server registers with a Kerberos Key Distribution Center (KDC).
For the DriverManager interface: Set the user ID, password, Kerberos server, and
security mechanism by setting the user, password, kerberosServerPrincipal, 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 Kerberos security mechanism with a user
ID and password:
import java.sql.*;
import com.ibm.db2.jcc.*;
com.ibm.db2.jcc.DB2BaseDataSource.ENCRYPTED_PASSWORD_SECURITY);
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
Chapter 10. Security under the IBM Data Server Driver for JDBC and SQLJ
// Set the port number
// Set the user ID
// Set the password
// Set security mechanism to
// User ID and encrypted password
// JDBC base
// IBM Data Server Driver for JDBC
// and SQLJ implementation of JDBC
453

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents