Help Centre › Building Processes
This article describes the RPA Database functionality to open a named database connection.
For a full list of available functions, please read DATABASE functions.
Description
The Connect to database function opens a named database connection for reuse across process steps. It supports MySQL, SQL Server, PostgreSQL, SQLite, and ODBC. Once opened, the connection can be referenced by name in subsequent database actions, avoiding repeated connection setup.
Setting it up
To use the Connect to database function, follow these instructions:
{{popups:rpas/add:action=db-connect}}
Once on a process map:
- Navigate to the process where you would like to add the Connect to database function
- Click on the green button's drop-down (right side of the green button labelled "Process")
- On the menu that appears, click on the "+ Activity" item
- From here you can select the Connect to database option
- Click "Add" once you are done
Input parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| Name | Yes | Text | - | A unique alias for the connection, used to reference it in subsequent steps |
| Type | Yes | Select (mysql / sqlserver / postgresql / sqlite / odbc) | - | The database engine to connect to |
| Host | No | Text | 127.0.0.1 | The hostname or IP address of the database server |
| Port | No | Number | - | The port number (uses the default port for the selected type if omitted) |
| Database | No | Text | - | The name of the database to connect to |
| Username | No | Text | - | The username for authentication |
| Connection string | No | Text | - | A full connection string that overrides host, port, and database parameters |
| Options | No | JSON object | - | Additional driver-specific options as a JSON object |
| Variable | No | Text | connected | Variable name to store the connection result |
Output variables
| Variable | Type | Description |
|---|---|---|
| {connected} | Boolean | True if the connection was established successfully, false otherwise |
Errors
| Error | Description |
|---|---|
| Connection failed | Unable to establish a connection to the database server |
| Authentication failed | The username or password is incorrect |
| Database not found | The specified database does not exist on the server |
Tips
- Use the connection_string parameter for complex connection configurations such as SSL, trusted connections, or non-standard drivers
- Store database credentials in the Credential Vault for security rather than hardcoding them in the process
- Give connections meaningful names (e.g. "production_db", "staging_db") to keep multi-database processes clear