Skip to content

How to Use Database Activities with Robusta RPA

This guide explains how to perform database operations, including connections, executing queries, and using stored procedures within Robusta RPA.

Prerequisites

  • Ensure the database management software can connect to the target database.
  • The computer where Robusta RPA is installed must have network access and authorization to the database IP.
  • A valid JDBC URL for your specific database (MySQL, PostgreSQL, Oracle, etc.) is required.

1. Establishing a Connection

The Open Connection activity under the Database component is used to connect to a database management system.

  1. Select the database type from the Driver name list.
  2. Enter the credentials in the Database user and Database password fields.
  3. If Database user is used, leave Database name blank (or vice versa, depending on the driver requirements).
  4. Provide a reference name in the Connection name field. This name is used to identify the connection in subsequent activities.
  5. In the Database URL field, enter the JDBC URL.

While Robusta supports MySQL, Oracle, Cloudera, PostgreSQL, ibm.as400, sybase, and Microsoft SQL Server, it is compatible with all database management systems that have JDBC support.

JDBC URL Examples

  • MySQL: jdbc:mysql://89.163.225.9:3306/cloudrpa_learnRPA?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8
  • Oracle (SID): jdbc:oracle:thin:@<hostName>:<portNumber>:<sid>;
  • Oracle (Service): jdbc:oracle:thin:@//<hostName>:<portNumber>/serviceName;

2. Executing Updates (DDL and DML)

The Execute update activity is used for queries that modify the database structure or data (CREATE, INSERT, UPDATE, DELETE).

  1. Enter the query in the QUERY SQL field.

Common Query Examples

Query Description
CREATE TABLE TBL_Training_NewTable (...) Creates a new table with specified columns and data types.
DROP TABLE TBL_Training_NewTable Deletes the specified table.
INSERT INTO TBL_Table VALUES (1, 'Value') Inserts a single row of data.
UPDATE TBL_Table SET Col = 'Val' WHERE ID = 1 Updates existing records based on a condition.

3. Retrieving Data

The Execute query activity sends SELECT queries to retrieve data.

  1. Enter the SELECT statement in the Query sql field.
  2. Specify a variable name in the Result dataset name field to store the returned data.
Query Description
SELECT * FROM TBL_Training_Company_Info; Assigns the returned table data to the defined dataset variable.

4. Using Stored Procedures

Stored procedures can return single values or result sets.

Case A: Procedure Returning a Single Value

Used when a procedure has an OUT parameter for a specific value.

Field Setup * param1: ["1", "STRING", "IN", "History"] * param2: ["2", "INTEGER", "OUT", "@total"]

Execution Parameters * Stored procedure call: {call subjects(?,?)}

Case B: Procedure Returning a Result Set

Used when a procedure returns a table-like structure.

Field Setup | Element | Description | | :--- | :--- | | param1 | ["1", "RESULTSET", "OUT", ""] | | query sql | {call SHOW_SUPPLIERS()} |

image


5. Closing the Connection

The Close Connection activity ends the session with the database.

  1. Enter the Connection name defined during the Open Connection step.

Verification

  • Check the RPA logs to ensure the Open Connection activity returns a success status.
  • For Execute query, verify that the dataset variable contains the expected rows.
  • Confirm database changes (like table creation or row insertion) using an external database management tool.