Distributed Session with database persistence

You can configure WAS so that the session information is stored in the database, so that if the server which was handling user request and where HttpSession was created fails and the request gets routed to other server, that server should be able to receive session information from DB.

You can follow these steps to configure DB based session persistence

  • First create a JDBC data source with all rights. The reason being when you do that WAS will create the tables necessary to store session information in the target database. In my local environment i did create jdbc/sessionDB datasource pointing to my local Apache Derby server

  • Then go to Application Servers > server_name > Session Management > Distributed environment setttings page and select database for storing distributed sessions


  • Click on the Database link to configure the database connection


  • Restart the cluster for new changes to take effect

  • Use the Distributed Session Sample application to test the distributed session



First i tried using the single row option for storing my session information and this is what the JSESSIONID looked like JSESSIONID=0002ohdZQLH8oQu3Zvogc6c8a-y:14dtuu8g3:14dtuueci. I also tried looking at what data is getting stored in the db and it looked like the session data is getting stored in SESSIONS table



If you take a close look you will notice that one record is inserted in db with value of ID and PROPID column equal to part of the JSESSIONID cookie

No comments:

Post a Comment