User Id-Only Security Under The Ibm Data Server Driver For Jdbc And Sqlj; Sqlj - IBM DB2 Manual

Table of Contents

Advertisement

IBM Data Server Driver for JDBC and SQLJ type 2 connectivity with no user ID
or password: For IBM Data Server Driver for JDBC and SQLJ type 2 connectivity, if
you use user ID and password security, but you do not specify a user ID and
password, the database system uses the external security environment, such as the
RACF security environment, that was previously established for the user. For a
CICS connection, you cannot specify a user ID or password.
User ID-only security under the IBM Data Server Driver for JDBC and

SQLJ

With the IBM Data Server Driver for JDBC and SQLJ, one of the available security
methods is user-ID only security.
To specify user ID security for a JDBC connection, use one of the following
techniques.
For the DriverManager interface: Set the user ID and security mechanism by setting
the user 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:
import java.sql.*;
import com.ibm.db2.jcc.*;
...
Properties properties = new Properties();
properties.put("user", "db2adm");
properties.put("securityMechanism",
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 and security mechanism by invoking the DataSource.setUser
and DataSource.setSecurityMechanism methods after you create the DataSource
object. For example:
import java.sql.*;
import com.ibm.db2.jcc.*;
...
450
Application Programming Guide and Reference for Java
com.ibm.db2.jcc.DB2BaseDataSource.CLEAR_TEXT_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
new String("" + com.ibm.db2.jcc.DB2BaseDataSource.USER_ONLY_SECURITY + ""));
// Set security mechanism to
// user ID and password
// JDBC base
// IBM Data Server Driver
// for JDBC and SQLJ
// implementation of JDBC
// Create a Properties object
// Set user ID for the connection
// Set security mechanism to
// user ID only
// Set URL for the data source
// Create the connection
// JDBC base
// IBM Data Server Driver
// for JDBC and SQLJ
// implementation of JDBC

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents