Oracle7 Server SQL Reference

Contents Index Home Previous Next

CONNECT (Embedded SQL)

Purpose

To log on to an Oracle7 database.

Prerequisites

You must have CREATE SESSION system privilege in the specified database.

If you are using Trusted Oracle7 in DBMS MAC mode, your operating system label must dominate both your creation label and the label at which you were granted CREATE SESSION system privilege. Your operating system label must also fall between the operating system equivalents of DBHIGH and DBLOW, inclusive.

If you are using Trusted Oracle7 in OS MAC mode, your operating system label must match the label of the database to which you are connecting.

Syntax

Keyword and Parameters

:user :password

specifies your username and password separately.

:user_password

is a single host variable containing the Oracle7 username and password separated by a slash (/).

To allow Oracle7 to verify your connection through your operating system, specify a :user_password value of '/'.

AT

identifies the database to which the connection is made. The database can be identified by either:

db_name is a database identifier declared in a previous DECLARE DATABASE statement.

:host_variable is a host variable whose value is a previously declared db_name.

USING

specifies the SQL*Net database specification string used to connect to a non-default database. If you omit this clause, you are connected to your default database.

Usage Notes

A program can have multiple connections, but can only connect once to your default database. For more information on this command, the Programmer's Guide to the Oracle Precompilers.

Example

The following example illustrate the use of CONNECT:

EXEC SQL CONNECT :username 
	IDENTIFIED BY :password 

You can also use this statement in which the value of :userid is the value of :username and :password separated by a "/" such as 'SCOTT/TIGER':

EXEC SQL CONNECT :userid 

Related Topics

COMMIT command [*] DECLARE DATABASE command [*] ROLLBACK command [*]


Contents Index Home Previous Next