nuosql
The nuosql
command line tool provides an environment to interact with one NuoDB database at a time.
nuosql
provides the capability to perform the following:
-
Execute SQL statements interactively.
-
Run batch scripts.
-
Access database metadata information.
-
Perform DBA functions.
To start a nuosql
session, provide the name of the database and the domain host on which a broker is running.
If the database is running on the local machine, some platforms allow you to just specify the database name.
You must also specify a username with which to connect nuosql
to the NuoDB database.
This can be the DBA user or any other SQL user created in the database.
If, for security reasons, a password is not specified as a command line argument or environmental variable, the user will be prompted to input the password via stdin.
Use the EXIT
or QUIT
command to terminate the current nuosql
session.
Syntax
nuosql { --help | --h | --version }
nuosql <dbName>[,<dbName>,...] --user <user-name> --password <password>
[ --config file_name ]
[--connection-property <conn_ppty=y>[,--connection-property <conn_ppty=yn>, ...]]
[--direct][--disable-footer]
[--file file_name [-v]]
[--history file_name]
[--init file_name [-v]]
[--log file_name][--nosemicolon][--pager <pager>][--schema schema_name]
[--prompt custom_prompt]
[--timer [on | off | full ]]
[--verbose [debug | info | warn | i18n ]]
[--vertical-output]
Options
The options for nuosql
are the following:
--config <file_name>
-
The
nuosql
command, by default, reads a configuration file named.nuosql.config
, located in the user’sHOME
directory, if it exists. To override the default path and filename, use the--config
option. For more information, see Configuration File. --connection-property <conn_ppty=y> [--connection-property <conn_ppty=yn>…]
-
Specifies properties for the
nuosql
client connection to the server. You can specify multiple connection properties on one command line. For a list of supported properties, see Connection Properties. <dbName>
-
Specification of at least one database name is required. The database name must be specified on the
nuosql
command line only. It cannot be specified in thenuosql
configuration file,.nuosql.config
.In a production environment, specify the database name in the following format. Specifying the
host
andport
are optional.database_name[@host[:port]]
On Windows, the specification of a host is mandatory. For example:
test test@localhost test@172.31.36.240:48004
In a development environment, it might be helpful to specify more than one database name or specify the same database name and vary the
host
and/orport
. If you specify more than one database name,nuosql
tries to use the first specification to connect. If that succeeds then the other specifications are not tried. If the first specification fails thennuosql
tries the second specification, and so on. To specify more than one database name, insert a comma as a delimiter. For example:test,test@localhost,test@172.31.35.188:48004
In a production environment, multiple specifications are not recommended. Instead, you should take advantage of load balancing that NuoDB can do for you. See Balancing Database Load Across Hosts.
--direct
-
Use a direct TE connection instead of via a connection provided by an Admin Process (AP). If this option is specified, the database name argument must include the port number of the TE,
database_name@host:port
. For examples, see Examples using nuosql. --disable-footer
-
Disables printing of row count and execution time.
--file <file_name> [-v]
-
Specifies the name of a batch file that contains one or more SQL statements to be executed by the
nuosql
command. Thefile_name
may also include the path. Using this option,nuosql
connects to the specified database, executes the SQL statements contained in the batch file, and exits. Each SQL statement can span multiple lines, but must be terminated with a semicolon. Errors generated by SQL statements in the batch file are ignored and execution continues with the next SQL statement. This option is similar to redirecting standard input to thenuosql
command. However, using the--file
option does not change the command history ofnuosql
(see History File). For example, see Batch Process using nuosql.The
-v
option enables the display of commands, timer, and row counts. --help | -h
-
Displays a help message. Provides this list of options for the command and a brief description of each option.
--history <file_name>
-
By default,
nuosql
writes all executed SQL commands to a file called.nuosql.history
, located in the user’sHOME
directory. To override the default path and filename, use the--history
option. The history file is used for command line history processing innuosql
.
The--history
option and command line history is not currently supported on Windows. --init <file_name> [-v]
-
By default,
nuosql
reads an initialization file named.nuosql.init
located in the user’sHOME
directory, if it exists. The--init
option is used to override this default path and filename. This allows the user to specify a SQL command file to be executed every timenuosql
starts up. After connecting to the database and executing all the commands in the init file,nuosql
displays the usual command line prompt and waits for additional commands to be entered interactively.The
-v
option enables the display of timer and row counts. --log <file_name>
-
Specifies the name of a file to which logging will be redirected. Used in conjunction with
--verbose
below. --nosemicolon
-
When running
nuosql
interactively, every SQL statement must end with a semicolon ( ; ). With the--nosemicolon
option,nuosql
will not require a semicolon command terminator. Instead,nuosql
will execute each line as a separate SQL command. --password <password>
-
Required if
--config
is not specified. This is the password for the user specified in the--user
option. --pager <pager>
-
Specifies a command through which all query output will be piped. For example, see Paginate Output.
--prompt <custom_prompt>
-
This optional parameter enables you change the default
SQL
prompt to any given string. This option is useful when multiple environments are available. After customizing the prompt in this way, you have a visual reminder of the environment you are connected to, rather than having the same generic prompt for allnuosql
connections. --schema <schema_name>
-
This is the schema that will be active when
nuosql
first connects to the database. Users can change to another schema by using theUSE
command (see USE) or by creating a new schema (see CREATE SCHEMA). If the--schema
command line option is not provided, thenuosql
session initial schema isUSER
. Any DDL commands issued to create new database objects will be owned by theUSER
schema. --show-prompt
-
By default when using the
--file
option aSQL
prompt is not shown before and after executing SQL commands. This option will show the prompt, similar to running thenuosql
command line tool interactively. This prompt will not be written to the history file. This option can be useful when reading commands from a file and redirecting output to another file. --timer [on | off | full ]
-
Reports the elapsed time for the execution of each SQL statement. The
off
mode is default. Theon
mode reports the elapsed time taken by thenuosql
client. Thefull
mode reports the elapsed time taken by thenuosql
client and additionally for non-DDL SQL statements, reports the elapsed time spent by the server (Transaction Engine) to process the command. --user <user_name>
-
Required if
--config
is not specified. This is the SQL username to use for the connection to the database. It can be the DBA username or any other username created (see CREATE USER). --verbose [debug | info | warn | i18n ]
-
Reports details in each level of logging or, for internationalization, the category of logging. The report includes the line number and the file name on which the error occurred.
By default, logging is sent to
stdout
. Alternatively, logging can be redirected to a file using the--log
option above.For example,
--verbose i18n
logs alldebug
,info
, andwarn
level logging regardingnuosql
internationalization. --version
-
Displays the version of the broker to which
nuosql
is connected. --vertical-output
-
Specifies that columns in rows should be displayed vertically, rather than horizontally. For example, see Display nuosql Output Vertically.