Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » SQL statements » Alphabetical list of SQL statements

GRANT CONNECT statement

Creates a new user, and can also be used by a user to change their own password. However, it is recommended that you use the CREATE USER statement to create users instead of the GRANT CONNECT statement.

Syntax
GRANT CONNECT TO userid, ...
[ IDENTIFIED BY password, ... ]
Parameters
  • CONNECT TO clause

    Creates a new user. GRANT CONNECT can also be used by any user to change their own password. To create a user with an empty string as the password, use:

    GRANT CONNECT TO userid IDENTIFIED BY "";

    To create a user with no password, use:

    GRANT CONNECT TO userid;

    A user with no password cannot connect to the database. This is useful if you are creating a group and do not want anyone to connect to the database using the group user ID.

    The verify_password_function option can be used to specify a function to implement password rules (for example, passwords must include at least one digit). If a password verification function is used, you cannot specify more than one user ID and password in the GRANT CONNECT statement.

Remarks

If you use this statement in a procedure, do not specify the password as a string literal because the definition of the procedure is visible in the SYSPROCEDURE system view. For security purposes, specify the password using a variable that is declared outside of the procedure definition.

Privileges

You must either be changing your own password using GRANT CONNECT, or have the MANAGE ANY USER privilege.

Side effects

Automatic commit.

Standards
  • ANSI/ISO SQL Standard

    Not in the standard.

Example

The following example creates a new database user named SQLTester, with password welcome.

GRANT CONNECT TO SQLTester
IDENTIFIED BY welcome