Ejemplo n.º 1
0
  /**
   * Constructs a new Session that operates within (is connected to) the context of this Database
   * object.
   *
   * <p>If successful, the new Session object initially operates on behalf of the user specified by
   * the supplied user name.
   *
   * @param username the name of the initial user of this session. The user must already exist in
   *     this Database object.
   * @param password the password of the specified user. This must match the password, as known to
   *     this Database object, of the specified user
   * @return a new Session object that initially that initially operates on behalf of the specified
   *     user
   * @throws SQLException if the specified user does not exist or a bad password is specified
   */
  synchronized Session connect(String username, String password) throws SQLException {

    User user = aAccess.getUser(username.toUpperCase(), password.toUpperCase());
    Session session = sessionManager.newSession(this, user, databaseReadOnly);

    logger.writeToLog(session, "CONNECT USER " + username + " PASSWORD \"" + password + "\"");

    return session;
  }
Ejemplo n.º 2
0
 /**
  * Records a Log entry representing a new connection action on the specified Session object.
  *
  * @param session the Session object for which to record the log entry
  * @throws HsqlException if there is a problem recording the Log entry
  */
 void logConnectUser(Session session) throws HsqlException {
   writeToLog(session, session.getUser().getConnectStatement());
 }