Open SQL Connection Action

Declaration

<AMSQLOPENCONNECTION CONNECTIONSTRING="Text"  PREDEFINEDCONNECTION="MyPreDefinedConn" />

See Also

Open SQL Connection-Setting Properties, Close SQL Connection Action, Execute SQL Query Action, Execute Stored Procedure Action

Description

Opens a database connection using the specified custom connection string or predefined connection string. The connection is identified by a unique session name, which can be referenced by subsequent SQL steps. This allows multiple SQL connections to run simultaneously. Use the Close SQL Connection action to close a SQL connection that is currently open.

This action also provides the option to create and name a new pre-defined connection string that can be used in subsequent steps and tasks.

Practical Usage

Used to establish a persistent connection for use with other Database steps.

Parameters

General Tab

Session Name

Text, Optional - Default "SQLSession1"
MARKUP: SESSION="SQLSession2"

Specifies the session name to identify this connection request in subsequent SQL steps. This allows several connections to be active simultaneously. If you are only using one connection at a time, do not specify a value other than the default.

Connection String—Custom

Text, Optional
MARKUP:
CONNECTIONSTRING="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Common Files\Borland Shared\Data\BCDEMOS.mdb"

Specifies a custom OLEDB connection string. The connection string provides driver, server, username, password and other important information to the OLEDB subsystem so that the connection can be made. The easiest way to generate a proper connection string is by clicking the New button in the visual step editor.

Connection String—Pre-defined

Text, Optional
MARKUP: PREDEFINEDCONNECTION="MyPreDefinedConn"

Specifies a pre-defined OLEDB connection string. An existing pre-defined connection string can be specified by name, or a custom connection string can be defined as above, named, and stored. A newly created pre-defined connection string will be available for use in subsequent steps and tasks.

Notes

Custom Description

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

Examples

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

<AMSQLOPENCONNECTION CONNECTIONSTRING="AM19y9I4LjuL6WguODTn8/bbnUTt4T7/MaI+H6MBnYGRI69B6ya5BxTt32MGksD0w8XqvTNi3YyQwIsWCXLeCLQJdBjCzJFhKavzojej+o1zcu/FJ/gAVr45Q==aME" />

<AMSQLOPENCONNECTION PREDEFINEDCONNECTION="MyPredefinedConn" />