A script-enabled browser is required for this page to function properly.

EXEC_SQL.OPEN_CONNECTION built-in function

This function opens a connection and assigns it a connection handle.

Syntax


FUNCTION EXEC_SQL.OPEN_CONNECTION
(username IN VARCHAR2,
password IN VARCHAR2,
datasource IN VARCHAR2)
RETURN EXEC_SQL.ConnType;

Parameter

Description

username

A string specifying the user name used to connect to the database.

password

A string specifying the password for the user name.

datasource

Either a string specifying the SQLNet alias or the OCA connection starting with ODBC:

Returns

A handle to the new database connection.

Example


PROCEDURE getData IS
-- a connection handle must have a datatype of EXEC_SQL.CONNTYPE
  connection_id EXEC_SQL.CONNTYPE;
...
 BEGIN
-- a connection string is typically of the form 'username/password@datasource'
   connection_id := EXEC_SQL.OPEN_CONNECTION('connection_string'); 
...

END;

See also

About the EXEC_SQL built-in package

EXEC_SQL built-in package