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 #469 background imageLoading...
Page #469 background image
ds.setPortNumber(5021); // Set the port number
ds.setUser("db2adm"); // Set the user ID
ds.setPassword("db2adm"); // Set the password
ds.setSecurityMechanism(
com.ibm.db2.jcc.DB2BaseDataSource.ENCRYPTED_PASSWORD_SECURITY);
// Set security mechanism to
// User ID and encrypted password
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
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.*; // JDBC base
import com.ibm.db2.jcc.*; // IBM Data Server Driver for JDBC
// and SQLJ implementation of JDBC
Chapter 10. Security under the IBM Data Server Driver for JDBC and SQLJ 453

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