Nisqlm System Commands
Nisqlm SQL Mode
Nisqlm Session Mode
Session mode enables users to establish database sessions (that is, connect to a database instance), change from one session to another, and disconnect database sessions. The .SESS system command enables users currently in SQL mode to access nisqlm Session mode and execute Session mode commands.
When nisqlm is invoked without connection name, database name, and user name arguments, or if any of the specified arguments is invalid, the user is automatically placed in Session mode. The CONNECT command can subsequently be used to establish a database session.
The following commands are supported in Session mode. Each must be terminated by a semicolon (;). When in Session mode, users may enter the HELP command followed by a semicolon (;) in order to display all available Session mode commands.
The CONNECT command enables a user to establish a database session by connecting to a running database instance. Up to 10 sessions may be established from a single client. When nisqlm successfully connects to a database instance, the user is automatically placed in SQL mode (in the default schema associated with the specified user authorization).
The CONNECT command has the following form (single quotation marks must be typed literally as they appear):
CONNECT 'connection-name' 'instance-name' 'user-name[/password]' ;
The connection-name argument must match the connection name used when the database instance was started with the nserv program. If nisqlm is being used to connect to a database instance running on a remote server, the client-side nucleus.ini file must contain a [CONNECTION connection-name] section that specifies the port number and host name used to connect to the database instance, and these must match the values specified for the same connection in the server-side nucleus.ini file. The connection name is not case-sensitive.
By default, the maximum number of client programs that may use a particular connection is 10 (this limit may be changed by including a MaxUsers entry in the appropriate CONNECTION section of the server-side nucleus.ini file).
The instance-name argument specifies the name of the database instance to which to connect. It must have been started using the specified connection name. The instance name is not case-sensitive.
The user-name argument must specify a legal user authorization in the database specified by the instance-name argument. The user name is not case-sensitive.
The password argument is required only if there is a password associated with the user authorization specified in the user-name argument. The password argument is case-sensitive, and must match the user's password exactly. The password argument must be preceded by a slash ( / ).
User passwords are case-sensitive.
The CONNECT command in this example connects as user dba to a database instance called vip, started using the connection server1_vip. No password has been assigned to the user.
CONNECT 'server1_vip' 'vip' 'dba';
The DISCONNECT command disconnects database sessions established from the current client (nisqlm). The DISCONNECT command performs an implicit ROLLBACK on the current transaction in the specified session. The DISCONNECT command has the following form:
DISCONNECT [ session | ALL ] ;
The session argument is optional. If no session is not specified, the current session (that is, the one denoted by the asterisk (*) in the nisqlm status display) will be disconnected. If included, the session argument is the number corresponding to the session to be disconnected.
The ALL keyword may be entered instead of the session argument in order to disconnect all database sessions established from the current client.
This example illustrates the use of the DISCONNECT command to disconnect a database session identified as session 3.
In this example, the current database session is disconnected.
The DURATION command specifies a maximum duration to be imposed on the processing of all SQL SELECT statements issued from the current session. After the DURATION command is issued, any SQL query issued within the session is subject to the specified limit on duration and will expire upon exceeding it. Query expiration restores the SQL prompt, and SAND CDBMS proceeds as if the query had never been issued. Other sessions established from the same client are unaffected. The DURATION command has the following general form:
DURATION minutes ;
The minutes argument is required and must be an integer corresponding to the desired maximum SQL query duration, specified in minutes. Specifying a minutes argument of 0 (zero) results in an infinite duration (that is, no limit on query processing time). All sessions have a default duration of 0.
The DURATION command in this example specifies a maximum SQL query duration of fifteen minutes for the current session.
The USE command changes the current database session. That is, the session specified as the argument for the USE command becomes the new current session, and all subsequent SQL statements are executed in the context of that current database session. The USE command has the following general form:
USE session-number ;
The session argument is required, and must be a number corresponding to an existing database session. The session identified by the session argument will become the current session. Only sessions established by the current client may be targeted by the USE command.
In this example, the USE command changes the current session to session 2.
Nisqlm System Commands
Nisqlm SQL Mode