\connect

Establishes a connection to database db, under the specified user user-name.

Establishes a connection to database db, under the specified user user-name. The previous connection is closed. If you omit specifying a database name, Vertica connects to the current database. If you omit specifying a user name argument, Vertica assumes the current user.

Syntax

\c[connect] [db [user-name]]

Error handling

Errors that prevent execution include specifying an unknown user and denial of access to the specified database. Vertica handles errors differently, depending on whether this command is executed interactively in vsql, or in a script:

  • VSQL handling: The current connection is maintained.

  • Script: Processing immediately stops with an error. This is prevents scripts from acting on the wrong database.