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 #466 background imageLoading...
Page #466 background image
com.ibm.db2.jcc.DB2BaseDataSource.CLEAR_TEXT_PASSWORD_SECURITY);
// Set security mechanism to
// user ID and password
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.
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
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.*; // JDBC base
import com.ibm.db2.jcc.*; // IBM Data Server Driver
// for JDBC and SQLJ
// implementation of JDBC
...
Properties properties = new Properties();
// Create a Properties object
properties.put("user", "db2adm"); // Set user ID for the connection
properties.put("securityMechanism",
new String("" + com.ibm.db2.jcc.DB2BaseDataSource.USER_ONLY_SECURITY + ""));
// Set security mechanism to
// user ID only
String url = "jdbc:db2://mvs1.sj.ibm.com:5021/san_jose";
// Set URL for the data source
Connection con = DriverManager.getConnection(url, properties);
// Create the connection
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.*; // JDBC base
import com.ibm.db2.jcc.*; // IBM Data Server Driver
// for JDBC and SQLJ
// implementation of JDBC
...
450 Application Programming Guide and Reference for Java

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