DB2 Version 9.7 for Linux, UNIX, and Windows

IBM Data Server Driver for JDBC and SQLJ security plugin support

You can create your own authentication mechanisms in the form of loadable libraries, or plugins, that DB2® for Linux, UNIX, and Windows loads to perform user authentication. To support development of security plugins in Java™, the IBM® Data Server Driver for JDBC and SQLJ provides security plugin support.

IBM Data Server Driver for JDBC and SQLJ security plugin support is available for IBM Data Server Driver for JDBC and SQLJ type 4 connectivity to DB2 for Linux, UNIX, and Windows servers only.

To use plugin security, you need a security plugin on the client and another plugin on the server.

The security plugins need to include the following things:
Two Java plugin samples are provided in sqllib/samples/java/jdbc to help you write Java security plugins:
JCCSimpleGSSPlugin.java
An implementation of a GSS-API plugin for the server, which performs user ID and password checking. This sample is a Java version of the C language sample program gssapi_simple.c.
JCCKerberosPlugin.java
A Kerberos security plugin for the client. This sample is a Java version of the C language sample program IBMkrb5.c.
When an application program obtains a connection using JDBC plugin security, it needs to set the following Connection or DataSource properties:
Table 1. Connection or DataSource property settings for Java security plugin use
Property Setting
com.ibm.db2.jcc.DB2BaseDataSource.user The user ID under which the Connection is to be obtained
com.ibm.db2.jcc.DB2BaseDataSource.password The password for the user ID
com.ibm.db2.jcc.DB2BaseDataSource.securityMechanism com.ibm.db2.jcc.DB2BaseDataSource.PLUGIN_SECURITY
com.ibm.db2.jcc.DB2BaseDataSource.pluginName The name of the plugin module for a server-side security plugin
com.ibm.db2.jcc.DB2BaseDataSource.plugin The plugin object for a client-side security plugin
Example: The following code sets the properties for a connection that uses GSS-API plugin security. The connection uses the JCCSimpleGSSPlugin sample plugin on the client side, and the gssapi_simple sample plugin on the server side.
java.util.Properties properties = new java.util.Properties();
properties.put("user", "db2admin");
properties.put("password", "admindb2");
properties.put("pluginName", "gssapi_simple");
properties.put("securityMechanism",
  new String(""+com.ibm.db2.jcc.DB2BaseDataSource.PLUGIN_SECURITY+""));
com.ibm.db2.jcc.DB2JCCPlugin plugin = 
  new com.ibm.db2.jcc.samples.plugins.JCCSimpleGSSplugin();
properties.put("plugin", plugin);
Connection con = java.sql.DriverManager.getConnection(url, 
  properties);