Example: Configuring for database session persistence using wsadmin
The following example configures the session management of a Web container for database session persistence.
Before performing this task you have to create a JDBC provider and create a data source that points to an existing database.
- Identify the application server and assign it to the server variable:
set server [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]Example output:
server1(cells/mycell/nodes/mynode/servers/server1:server.xml#Server_1)- Identify the session management belonging to the server and assign it to the smgr variable:
set smgr [$AdminConfig list SessionManager $server]Example output:
(cells/mycell/nodes/mynode/servers/server1:server.xml#SessionManager_1)- Modify database session persistence:
$AdminConfig modify $smgr {{sessionDatabasePersistence {{datasourceJNDIName jdbc/mySession} {userId myUser} {password myPassword}}}}This command sets the minimum set of attributes to configure database session persistence. You can optionally modify the db2RowSize and tableSpaceName attributes too.
- Save the changes with the following command:
$AdminConfig save