Configure for database session persistence
We can configure a database to collect session data for database session persistence.
To configure the session management facility for database session persistence...
- Create and configure a JDBC provider.
- Create a data source pointing to a database.
Use the JDBC provider definedd: Resources > JDBC > JDBC Providers > JDBC_provider > Data Sources > New. The data source should be non-JTA, for example, non-XA enabled. Note the JNDI name of the data source.
Point to an existing database.
(zos) Point to the z/OS DB2 database containing the DB2 table for session persistence.
(zos) Example configuration for session persistence:
Name Sessions JNDI Name jdbc/sessions Container managed persistence Selected Component-managed Authentication Alias CELL/jaasalias Container-managed Authentication Alias CELL/jaasalias
- Verify that the correct database is listed under Resources > JDBC Providers > JDBC_provider > Data Sources > datasource_name. If necessary, contact the database administrator to verify the correct database name.
(zos) For example:
Database Name LOC1 (specify the system)
- (zos) Create a DB2 table in the z/OS DB2 database that will be used for session persistence.
- (zos) Configure the DB2 table for session persistence.
- Go to the appropriate level of Session Management.
- Under Additional Properties, click Distributed Environment Settings
- Select and click Database.
- Specify the Data Source JNDI name from a previous step. The database user ID and password are case-sensitive.
- Database user ID and password used to access the database and for table creation. When created the data source, we might have specified a Container Managed Authentication Alias or a Component Managed Authentication Alias; however, these two settings are not used by the session manager for session persistence. The session manager uses the userId and password specified in this step for session persistence.
- (zos)(iseries) Optional: Append the schema name in the session User ID field to have more than one instance of the session table.
The session manager uses the schema name to qualify the session table name for all database operations. If only the userid is specified without the schema name, the schema name defaults to NULL and therefore a table name with NULL as the schema name, for example, NULL.SESSIONS, is created. We can create multiple session tables with different schema names, other than NULL, and access them separately by modifying the user name to contain the appropriate schema name.
- Retype the password for confirmation.
- Configure a table space and page sizes for DB2 session databases.
- Switch to a multirow schema.
- Click OK.
- To change the tuning parameters, click Custom Tuning Parameters under Additional properties.
- Click Apply.
- Click Save.
Subtopics
- Switching to a multi-row schema
The multi-row schema configuration supports storing an unlimited amount of data that is only bounded by the database capacities in an application. The application can read individual fields instead of the whole record, which can help to improve performance by avoiding unnecessary Java object serialization. Configure the session management facility to store each attribute in a session object in its own row in the database using the multi-row schema configuration.
- (iseries)(dist) Configure tablespace and page sizes for DB2 session databases
If we are using DB2 for session persistence, we can increase the page size to optimize performance for writing large amounts of data to the database. Page sizes of 8K, 16K, and 32K are supported.
- (zos) Create a DB2 table for session persistence
Session data is collected and stored in a DB2 table. If we are using DB2 for session persistence, create and define a DB2 table that is associated with the application server.
- (zos) Configure a table for session persistence
To configure a table for collecting session data, add the name of the table to the web container configuration properties.
- Create a table for session persistence
Use a database table to collect and store session data. For a database table for session persistence, create and define a database table that is associated with the application server.
- Database settings
Use this page to specify the settings for database session support.
Related concepts
Distributed sessions Sessions
Related tasks
Configure a JDBC provider using the administrative console Configure database session persistence
HTTP session problems Tune parameter settings (custom tuning parameters)