Friday, May 14, 2004

How to use DB2 7 as the session data source for WebSphere 4

Work related. I never did find a single document that spelled all this out in one simple sequence of steps. So here goes.

  1. Install DB2 if it is not already installed.
  2. On the database server, create a database to use for the session data. I assume you need one database for each server group, I haven't tried doing it any other way.
  3. Install the DB2 Admin Client on the app server box box. (Skip this step if this is the same machine where you installed the DB2 database)
  4. Run Start->Programs->IBM DB2->Client Configuration Assistant on the app server.
  5. Choose "add".
  6. Choose "Manually configure a connection to a database".
  7. Protocol: TCP/IP
  8. Hostname: (whatever DB server is being used)
  9. Port: 50000
  10. Database and database alias: (whatever name you created)
  11. Take the defaults for everything else .
  12. Finish.
  13. Test the connection.
  14. Assuming that the binaries for the admin client installed in c:\program files\sqllib, go into c:\program files\sqllib\java12 and execute these commands in this order. This is absolutely neccessary in order for WebSphere to be able to use the db2 libraries.
    • jdbc20.exe
    • usejdbc2.bat
  15. In websphere, set up a JDBC provider for DB2. The jar file for the classpath is c:\program files\sqllib\java\ Note that is a ZIP file, not a JAR.
  16. Configure a datasource under this provider. In single-server edition, there are places to enter the "databaseName". Use the same one that you've used in all the other steps. In advanced, you have to add this as a custom property.
  17. In the properties of the server group, go to "Services" tab. Highlight the "Session Manager Service" and hit "Edit Properties".
  18. On the "Persistence" tab, check "enable persistent sessions".
  19. Choose the "Low (optimize for session failover)" performance option.
  20. On the database tab, configure the same datasource you set up in step 16.
  21. If you get errors about "unsatisfied link" or something about DLL files not being in JAVA_LIBARARY_PATH, try restarting the admin server or as a last resort the physical machine.