Extensions.SQL.CloseConnection
Jump to navigation
Jump to search
Classification
Name | CloseConnection |
Short Description | Closes the current connection |
Class | Action |
Extension | OTX SQL extension |
Group | SQL related Actions |
Exceptions | ConnectionException |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
ActionRealisation SQL.CloseConnection(ConnectionVariable connection);
Description
The CloseConnection action closes the current connection and releases any resources associated with the current connection. The use of CloseConnection is optional. An OTX runtime system will automatically close any open connection at an appropriate time, e.g. at the end of the runtime execution. If a sequence uses a connection after it is been closed by a CloseConnection action, the runtime system will throw an otx:InvalidReferenceException.
Properties
Name | Data Type | Class | Default | Cardinality | Description |
connection | Connection | Variable | - | [1..1] | This element represents the specified connection variable that shall be closed. |
OTL Examples
/// Local Declarations
SQL.Connection Connection1;
Exception Exception1;
/// Flow
try
{
Connection1 = SQL.CreateConnection("DRIVER={SQL Server};Server=.;InitialCatalog=classicmodels;username=sa;password=saas");
}
catch (Exception)
{
Connection1 = SQL.CreateConnection("jdbc:sqlserver://localhost;databaseName=classicmodels;username=sa;password=saas");
}
catch (Exception Exception1)
{
throw Exception1;
}
SQL.CloseConnection(Connection1);