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
nuosqlcommand, by default, reads a configuration file named.nuosql.config, located in the user’sHOMEdirectory, if it exists. To override the default path and filename, use the--configoption. For more information, see Configuration File. --connection-property <conn_ppty=y> [--connection-property <conn_ppty=yn>…]-
Specifies properties for the
nuosqlclient 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
nuosqlcommand line only. It cannot be specified in thenuosqlconfiguration file,.nuosql.config.In a production environment, specify the database name in the following format. Specifying the
hostandportare optional.database_name[@host[:port]]On Windows, the specification of a host is mandatory. For example:
test test@localhost test@172.31.36.240:48004In a development environment, it might be helpful to specify more than one database name or specify the same database name and vary the
hostand/orport. If you specify more than one database name,nuosqltries to use the first specification to connect. If that succeeds then the other specifications are not tried. If the first specification fails thennuosqltries 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:48004In 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
nuosqlcommand. Thefile_namemay also include the path. Using this option,nuosqlconnects 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 thenuosqlcommand. However, using the--fileoption does not change the command history ofnuosql(see History File). For example, see Batch Process using nuosql.The
-voption 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,
nuosqlwrites all executed SQL commands to a file called.nuosql.history, located in the user’sHOMEdirectory. To override the default path and filename, use the--historyoption. The history file is used for command line history processing innuosql.
The--historyoption and command line history is not currently supported on Windows. --init <file_name> [-v]-
By default,
nuosqlreads an initialization file named.nuosql.initlocated in the user’sHOMEdirectory, if it exists. The--initoption is used to override this default path and filename. This allows the user to specify a SQL command file to be executed every timenuosqlstarts up. After connecting to the database and executing all the commands in the init file,nuosqldisplays the usual command line prompt and waits for additional commands to be entered interactively.The
-voption 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
--verbosebelow. --nosemicolon-
When running
nuosqlinteractively, every SQL statement must end with a semicolon ( ; ). With the--nosemicolonoption,nuosqlwill not require a semicolon command terminator. Instead,nuosqlwill execute each line as a separate SQL command. --password <password>-
Required if
--configis not specified. This is the password for the user specified in the--useroption. --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
SQLprompt 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 allnuosqlconnections. --schema <schema_name>-
This is the schema that will be active when
nuosqlfirst connects to the database. Users can change to another schema by using theUSEcommand (see USE) or by creating a new schema (see CREATE SCHEMA). If the--schemacommand line option is not provided, thenuosqlsession initial schema isUSER. Any DDL commands issued to create new database objects will be owned by theUSERschema. --show-prompt-
By default when using the
--fileoption aSQLprompt is not shown before and after executing SQL commands. This option will show the prompt, similar to running thenuosqlcommand 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
offmode is default. Theonmode reports the elapsed time taken by thenuosqlclient. Thefullmode reports the elapsed time taken by thenuosqlclient 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
--configis 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--logoption above.For example,
--verbose i18nlogs alldebug,info, andwarnlevel logging regardingnuosqlinternationalization. --version-
Displays the version of the broker to which
nuosqlis connected. --vertical-output-
Specifies that columns in rows should be displayed vertically, rather than horizontally. For example, see Display nuosql Output Vertically.