Updated February 8th 2018.
The Database block is used to execute a query on an ODBC-compliant database such as Oracle, SQL Server, DB2, MySQL, MongoDB or any other. This can be highly useful for driving automation cases with data.
See the Database lesson to see examples of how to use data from databases in test cases.
Fully expanded, the Database block looks like this:
The Block Header (“Database”)
The green input connector in the header is used to trigger the block to start executing.
The green output connector in the header triggers when the database query has been executed and the result is ready.
The title of the block (“Database”) can be changed by double-clicking on it and typing in a new title.
The name of any previously configured ODBC connection on the computer where the test case will be run.
For some ODBC drivers it’s not possible to specify the user and/or password as part of setting up the ODBC connection in that case the name of the ODBC connection is also specified as a named parameter: DSN=ODBC_connectionName;USR=username;PWD=xyz etc.
Please check following article for more information.
The ODBC-compliant SQL query statement that will be executed on the database.
Text fields (for Query)
Add any number of fields that can contain dynamic content and be used as tokens in the query.
Pressing Refresh button will execute query against the database and returns the columns defined in the query.
Note: It’s not possible to click the Refresh button if the query field contains any dynamic fields (by clicking ‘Add field’), the building block will always return an error in this case.
The time in milliseconds from the query is sent until the last byte of the response was received.
The maximum time spent waiting for the database query to complete before giving up and triggering the green output connector (see above).
The default value is 10 seconds.
Examples of usage: