code: private void loadUser(String username)
      {
          try
          {
              if (null==_con)
                  connectDatabase();
              
              if (null==_con)
                  throw new SQLException("Can't connect to database");
              
              PreparedStatement stat = _con.prepareStatement(_userSql);
              stat.setObject(1, username);
              ResultSet rs = stat.executeQuery();
      
              if (rs.next())
              {
                  Object key = rs.getObject(_userTableKey);
                  put(username, rs.getString(_userTablePasswordField));
                  stat.close();
                  
                  stat = _con.prepareStatement(_roleSql);
                  stat.setObject(1, key);
                  rs = stat.executeQuery();
  
                  while (rs.next())
                      addUserToRole(username, rs.getString(_roleTableRoleField));
                  
                  stat.close();
              }
          }
          catch (SQLException e)
          {
              log.warn("UserRealm " + getName()
                        + " could not load user information from database", e);
              connectDatabase();
          }
      }
docs: /* ------------------------------------------------------------