Skip to Main Content
SQL in a Nutshell
book

SQL in a Nutshell

by Kevin Kline
December 2000
Intermediate to advanced content levelIntermediate to advanced
224 pages
9h 52m
English
O'Reilly Media, Inc.
Content preview from SQL in a Nutshell

Name

CONNECT

Synopsis

The CONNECT statement establishes a connection to the DBMS and to a specific database within the DBMS.

Vendor

Command

SQL Server

Supported, with limitations

MySQL

Not supported

Oracle

Supported

PostgreSQL

Not supported

SQL99 Syntax and Description

CONNECT [TO] DEFAULT
| {[server_specification] [AS connection_name] [USER user_name ] }

If the CONNECT statement is invoked without explicitly disconnecting, the old session becomes dormant and the new session becomes active. The period between issuing the CONNECT and DISCONNECT statements is commonly called a session . Typically, users complete all work on a DBMS during an explicitly invoked session.

Tip

The Oracle tool SQL*Plus uses the CONNECT command somewhat differently: to connect a user to a specific schema.

The CONNECT TO DEFAULT statement has somewhat variable results, since different vendors implement it differently. But according to the standard, this command should initiate a default session with the server where the user authorization is the default and the current database is the default.

In contrast to CONNECT TO DEFAULT, CONNECT TO server_name allows you to specify the server. Here, the connection is made to the server that is explicitly named. In addition, the connection may be declared using AS and a specific user with USER.

Oracle Syntax and Variations

CONN[ECT] [[username/password] [AS [SYSOPER | SYSDBA] ] ]

The CONNECT clause allows a database connection as a specific username. Alternately, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

SQL in a Nutshell, 3rd Edition

SQL in a Nutshell, 3rd Edition

Kevin Kline

Publisher Resources

ISBN: 1565927443