Database

SQL Statement

The SQL Statement Advanced action executes SQL statements. It enables you to perform administrative tasks like cleaning a database after a test. It also allows you to get business-related metrics that you can monitor, for example the number of items in a work queue or the number of checkouts during the last minute.

The action produces an XML output that includes a status of the executed SQL statement as well as an optional section containing the results of the query. The query results are also stored in Neotys Design Studio variables.

Information: In case of connection with Microsoft SQL Server 2005, you need to replace the Microsoft SQL Server 4.1 JDBC Driver with the Microsoft SQL Server 4.0 JDBC Driver by following this procedure.

Parameters

Variables

When executing a query, be careful to specify the variable name, i.e "sqlEntries" and not "${sqlEntries}".

The query result values will be retrieved in the following variables:

Examples

An example of removing all lines of a table:

An example of getting number of rows:

An example of SELECT with a custom driver:

SQL Connection

The SQL Connection Advanced action creates a database connection.

Parameters

Examples

An example of creating a connection to a MySQL database:

An example of creating a connection to a DB2 database:

SQL Disconnection

The SQL Disconnection Advanced action closes a previously opened database connection.

Parameters

Example

An example of closing the connection "myConnection".