DB2 supports the Generic Security Standard (GSS) plug-in for authentication. The GSS plug-in provides a generic interface that eliminates the need to write your application for specific security implementations based on platform, security mechanism, or transfer protocol. The plug-in consists of a set of APIs that you can implement to customize your authentication requirements and interoperate with various security methods.

The following steps outline how to configure a GSS plug-in for authentication.

  1. Set the AuthenticationMethod connection property to pluginSecurity.
  2. Set the GSSPluginName connection property to the plug-in name enabled on the server. The plug-in name is case-sensitive.
  3. Set the GSSPluginObject connection property to a valid object of a class that extends the com.ddtek.jdbc.db2.gssplugin.DB2GSSPluginClient class and provides a valid implementation for the getTicket() method. This value must be a data source object or a java.util.Properties object supplied through the DriverManager class.
    Note: The implementation of the GSSPluginObject property depends on the type of GSS APIs enabled on the DB2 server. Both the server and the client must have the same plug-in enabled. The server must have pluginSecurity configured.

    The following examples show the connection information required to establish a session using the GSS plug-in authentication.

    Connection URL

    jdbc:datadirect:db2://serverName:60000;databaseName=dbName;
    java.util.Properties properties = new java.util.Properties(); 
    properties.put("authenticationMethod", "pluginSecurity"); 
    properties.put("user", "userName");
    properties.put("password", "password");
    properties.put("GSSPluginName", "gssapi_name");
    properties.put("GSSPluginObject", new DB2GSSPlugin());
    Connection connection= DriverManager.getConnection(connectionUrl, properties);

    Data Source

    DB2DataSource dataSource = new DB2DataSource();
    dataSource.setServerName("serverName");
    dataSource.setPortNumber(60000);
    dataSource.setDatabaseName("dbName");
    dataSource.setUser("userName");
    dataSource.setPassword("password"); 
    dataSource.setAuthenticationMethod("pluginSecurity");
    dataSource.setGSSPluginName("gssapi_name");
    dataSource.setGSSPluginObject(new DB2GSSPlugin());
    Connection connection = dataSource.getConnection();