Extensions.SQL.CreateConnection
Jump to navigation
Jump to search
Contents
Classification
Name | CreateConnection |
Short Description | Open a connection using the specified connection string for access |
Class | Term |
Extension | OTX SQL extension |
Group | SQL related Terms |
Exceptions | ConnectionException |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
ConnectionTerm SQL.CreateConnection(StringTerm connectionString);
Description
The CreateConnection term will open a connection using the specified connection string for access and returns the Connection for the application.
Return Value
The Term returns the value, see table below.
In OTX, Terms are categorized according to its return data type!
Data Type | Description |
Connection |
Properties
Name | Data Type | Class | Default | Cardinality | Description |
connectionString | String | Term | - | [1..1] | Specifies the location of the data source that is required for the connection. Connection string used to create the connection that pass for creation of command variable. The connection string includes the source database name and other parameters needed to establish the initial connection. |
OTL Examples
/// Local Declarations
SQL.Connection Connection1;
/// Flow
try
{
// for DotNet platform
Connection1 = SQL.CreateConnection("DRIVER={SQL Server};Server=.;InitialCatalog=classicmodels;username=sa;password=saas");
}
catch (Exception)
{
// for Java platform
Connection1 = SQL.CreateConnection("jdbc:sqlserver://localhost;databaseName=classicmodels;username=sa;password=saas");
}