# Define RDBMS security realm database schema

Before you begin

Configure an RDBMS security realm. See Configure RDBMS security realms.

To define the database schema used by the RDBMS security realm:

1. In the left pane, expand Compatibility Security > Realms and click the name of the RDBMS security realm.
2. Under Configuration > Schema for the RDBMS security realm, define the schema used to store Users, Groups, and ACLs in the database in the Schema Properties box.

   The following code example contains the database statements entered in the Schema properties for the RDBMS code example shipped with WebLogic Server in the `/samples/examples/security/rdbmsrealm` directory.

       "getGroupNewStatement=true;getUser=SELECT U_NAME, U_PASSWORD FROM users WHERE U_NAME = ?;
       getGroupMembers=SELECT GM_GROUP, GM_MEMBER from groupmembers WHERE GM_GROUP = ?;
       getAclEntries=SELECT A_NAME, A_PRINCIPAL, A_PERMISSION FROM aclentries WHERE A_NAME = ? ORDER BY A_PRINCIPAL;
       getUsers=SELECT U_NAME, U_PASSWORD FROM users;
       getGroups=SELECT GM_GROUP, GM_MEMBER FROM groupmembers;
       getAcls=SELECT A_NAME, A_PRINCIPAL, A_PERMISSION FROM aclentries ORDER BY A_NAME, A_PRINCIPAL;
       getPermissions=SELECT DISTINCT A_PERMISSION FROM aclentries;
       getPermission=SELECT DISTINCT A_PERMISSION FROM aclentries WHERE A_PERMISSION = ?;
       newUser=INSERT INTO users VALUES ( ? , ? );
       addGroupMember=INSERT INTO groupmembers VALUES ( ? , ? );
       removeGroupMember=DELETE FROM groupmembers WHERE GM_GROUP = ? AND GM_MEMBER = ?;
       deleteUser1=DELETE FROM users WHERE U_NAME = ?;
       deleteUser2=DELETE FROM groupmembers WHERE GM_MEMBER = ?;
       deleteUser3=DELETE FROM aclentries WHERE A_PRINCIPAL = ?;
       deleteGroup1=DELETE FROM groupmembers WHERE GM_GROUP = ?;
       deleteGroup2=DELETE FROM aclentries WHERE A_PRINCIPAL = ?"

3. Click Save to save your changes.