Log on

When you run the nzsql command, you must supply a database account user name, password, and the name of the database to which you are connecting. If your system supports multiple schemas, you can also specify the schema to which you want to connect.

If you do not specify a schema, the nzsql command connects to the default schema for the database, or to a schema name that matches your user name if the enable_user_schema variable is set to TRUE. You can enter this information about the nzsql command line, or you can specify the information in environment variables before you begin your nzsql session. For example, you can enter the following from a command window prompt:
nzsql -d sales -u mlee -pw blue 
Welcome to nzsql, the Netezza SQL interactive terminal.

Type:  \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit 
SALES.SCHEMA(MLEE)=>

By default, uppercase letters are used to display SQL output. The system case can be configured to use lowercase instead, which was the default in earlier Netezza Performance Server releases. The following command shows how to connect to a specific database and schema:

nzsql -d sales -schema test -u mlee -pw blue
 Welcome to nzsql, the Netezza SQL interactive terminal.

Type:  \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit 
 SALES.TEST(MLEE)=>
Or, you can set the variables in your command shell by using variables such as the following, and then use the nzsql command without any arguments:
export NZ_USER=john
export NZ_PASSWORD=red
export NZ_DATABASE=sales
export NZ_SCHEMA=exp
nzsql
Welcome to nzsql, the Netezza SQL interactive terminal.

Type:  \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit
SALES.EXP(JOHN)=>

Throughout the remainder of this publication, the nzsql command output is abbreviated to omit the welcome text for brevity in the examples.

The Netezza Performance Server system has a default admin database user account who is the superuser of the Netezza Performance Server databases. The admin user can connect to any database and schema; load data; create, alter, and drop any objects; and create and manage new database users. Typically the admin user creates accounts so that other users can access one or more databases or schemas, and run queries. The admin user can also create accounts with administrative permissions so that other users can be allowed to do tasks such as manage databases and user setup, backups, and other administrative tasks.

Any user who is the owner of a database automatically has full privileges to all the objects in the database. Similarly, for systems that support multiple schemas in a database, the schema owner automatically has full privileges to all the objects in the schema.