Before you start
When implementing security in a Web application, a JAAS module is required to specifically handle user authentication and authorization. WebSphere® Application Server Community Edition provides a SQL realm that can connect to a database for obtaining user credentials. In this tutorial, you will see how to set up tables for creating an SQL realm in DB2® Express-C, how to set up a development environment using the Eclipse Web Tooling Platform to create a Web application, and how to deploy the Web application to WebSphere Application Server Community Edition from Eclipse.
All Web applications should employ some level of security for user authentication and authorization to verify a user’s identity and enable access to application functions that are applicable to the user's role.
Web applications can use LDAP, database, file system, Kerberos, or other such systems to provide authentication and authorization. To access security data from the selected method or system, an SQL realm is set up by creating tables in a database and configuring a Java Authentication and Authorization Service (JAAS) module to access these tables from an application server.
Figure 1 shows different components in WebSphere Application Server Community Edition (hereafter referred to as Community Edition) used to provide an SQL realm. The Web application uses an SQL realm that connects to the database using a pool or driver. The user credentials are stored in tables in the database and are fetched when calls are made using the JAAS SQL realm.
Figure 1. Components of an SQL realm
Setting up a database realm involves performing these general steps:
- Create tables for users and groups in DB2 Express-C.
- Deploy a database pool in Community Edition, if the realm is going to use a pool to connect to the database.
- Deploy the SQL realm plan in Community Edition.
- Configure and deploy the Web application that uses the SQL realm.
The remainder of this tutorial explains these tasks in detail.


