ODBC Connection
Verb: odbcConnect
Available from: <Standard>
Creates and stores data for connection to the ODBC Database in a connection string, so it can be used later.
Syntax
odbcConnect --connectionstring(String) (DbConnection)=connection
Inputs
| Script | Designer | Required | AcceptedTypes | Description |
|---|---|---|---|---|
| --connectionstring | Connection String | Required | Text | Connection string used to connect to the ODBC Database.
There must be a previously configured ODBC Database. |
Outputs
| Script | Designer | AcceptedTypes | Description |
|---|---|---|---|
| connection | Connection | Database Connection | Variable that holds the connection to the ODBC database. |
Example
This command connects to the Database using ODBC and checks with another command, the Assert Condition, if the connection string has stored the data, displaying the message "Could not connect to the Database!" if the string is empty.
defVar --name dbConnection --type DbConnection
// Connect to the bank via the connection string and store the data in the connection variable.
odbcConnect --connectionstring "Driver={Microsoft Access Driver (*.mdb)}; Dbq=C:\\file.mdb; Uid=Admin; Pwd=; \r\n" dbConnection=connection
// Check whether the string is empty or not.
assert --message "Could not connect to the database!" --left "${dbConnection}" --operator "Is_Null" --negate