DATABASE Connect to database function

Open a named database connection (MySQL, SQL Server, PostgreSQL, SQLite, ODBC) for reuse across steps.

Help CentreBuilding 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:

  1. Navigate to the process where you would like to add the Connect to database function
  2. Click on the green button's drop-down (right side of the green button labelled "Process")
  3. On the menu that appears, click on the "+ Activity" item
  4. From here you can select the Connect to database option
  5. Click "Add" once you are done

Input parameters

ParameterRequiredTypeDefaultDescription
NameYesText-A unique alias for the connection, used to reference it in subsequent steps
TypeYesSelect (mysql / sqlserver / postgresql / sqlite / odbc)-The database engine to connect to
HostNoText127.0.0.1The hostname or IP address of the database server
PortNoNumber-The port number (uses the default port for the selected type if omitted)
DatabaseNoText-The name of the database to connect to
UsernameNoText-The username for authentication
Connection stringNoText-A full connection string that overrides host, port, and database parameters
OptionsNoJSON object-Additional driver-specific options as a JSON object
VariableNoTextconnectedVariable name to store the connection result

Output variables

VariableTypeDescription
{connected}BooleanTrue if the connection was established successfully, false otherwise

Errors

ErrorDescription
Connection failedUnable to establish a connection to the database server
Authentication failedThe username or password is incorrect
Database not foundThe 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

Related functions

See it working on your own data

Everything documented here ships with the platform – try the document tools free, or go live in 7 days.