Vertica Analytics Platform Version 10.1.x Documentation
Connecting from the Command Line
You can connect to a database using vsql from the command line on multiple client platforms.
If the connection cannot be made for any reason—for example, you have insufficient privileges, or the server is not running on the targeted host—vsql returns an error and terminates.
/opt/vertica/bin/vsql [-h host] [ option...] [ dbname [ username ] ]
Optional if you connect to a local server. You can provide an IPv4 or IPv6 IP address or a host name.
For Vertica servers that have both IPv4 and IPv6 addressed and you have provided a host name instead of an IP address, you can prefer to use an IPv4 address with the
One or more vsql Command-Line Options
If the database is password protected, you must specify the -w or
The name of the target database, by default your Linux user name.
A database username, by default your Linux user name.
vsql returns 0 to the shell when it terminates normally. Otherwise, it returns one of the following:
- 1: A fatal error occurred—for example, out of memory or file not found.
- 2: The connection to the server went bad and the session was not interactive
- 3: An error occurred in a script and the variable
- Unrecognized words in the command line might be interpreted as database or user names.
The following example shows how to capture error messages by redirecting vsql output to the output file
$ vsql --echo-all < retail_queries.sql > retail_queries.out 2>&1
Was this topic helpful?