connect

Connects to the database indicated by the ConnectionURLString.

Syntax

CONNECT ConnectionURLString [ PROTOCOL Identifier ]
    [ AS Identifier ]

Description

Connects to the database indicated by the ConnectionURLString. You have the option of specifying a name for your connection. Use the Set Connection command to switch between connections. If you do not name a connection, the system generates a name automatically.

Note

If the connection requires a user name and password, supply those in the connection URL string, as shown in the example.

If the connect succeeds, the connection becomes the current one and snappy displays a new prompt for the next command to be entered. If you have more than one open connection, the name of the connection appears in the prompt.

All further commands are processed against the new, current connection.

Example

snappy> protocol 'jdbc:derby:';
snappy> connect '//armenia:29303/myDB;user=a;password=a' as db5Connection; 
snappy> show connections;
DB5CONNECTION* -        jdbc:derby://armenia:29303/myDB
* = current connection