SQL Query Action Icon

Open SQL Connection

 

Declaration

<AMSQLOPENCONNECTION SESSION="text" PREDEFINEDCONNECTION="text%" />

See Also

Close SQL Connection | SQL Query | Stored Procedure | Web Service | FTP (File Transfer Protocol) | HTTP (Hypertext Transfer Protocol) | MSMQ (Microsoft Message Queuing) | Microsoft SharePoint

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 Properties

Property

Type

Required

Default

Markup

Description

Session Name

Text

Yes

SQLSession1

SESSION="SQLSession2"

Specifies the session name of the SQL connection to open.

Connection String - Custom

Text

Yes

(Empty)

CONNECTIONSTRING=

"AM1P2qCkbYiFHdqWN7qDphOEw==aME"

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. Tis opens the Data Link Properties Wizard dialog allowing you to setup a custom connection string.

Connection String - Pre-defined

Text

Yes

(Empty)

PREDEFINEDCONNECTION=

"%MyPreDefinedConnection%"

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 of the task.

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties lets you instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Additional Notes

Expressions, Variables & Functions

A percent sign is used as a special character in AutoMate to indicate the beginning and end of an expression. This allows variables, functions and other expressions to be entered in any text parameter of a task's properties. For example: %1+1% inside a task will resolve to 2 at runtime. A more elaborate example is %FileDateTime(myFile)% which results to the date/time of myFile. To help construct expressions, you can open Expression Builder by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on functions

More on extended functions
More on the expression builder

Example

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

 

Description: Establish SQL connection using predefined connection string named "%thecommection%".  SQL session name is "SQLSession10".  

 

<AMSQLOPENCONNECTION SESSION="SQLSession10" PREDEFINEDCONNECTION="%thecommection%" />

 

↑ Top of Page