Connect to Oracle
Connects to an Oracle database.
Command availability: IBM RPA SaaS and IBM RPA on premises
Description
Establishes a connection with an Oracle server database.
Dependencies
You need a valid connection string to connect to the Oracle database. See the connectionstring
parameter section for examples of valid connection strings.
Script syntax
IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in RPA Studio's Script mode.
oracleConnect --connectionstring(String) (DbConnection)=connection
Input parameters
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
Connection String | connectionstring |
Required |
Text |
Connection string to connect to the Oracle Database. See the Connection string parameter section for details. |
connectionstring
parameter
The connectionstring
parameter is where you enter the string that includes key-value pairs providing the necessary information to connect to the Oracle database. The following code blocks are examples of valid connection strings:
Local Database (File-based)
Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;
Server Database
Data Source=//serverName:port;User Id=myUsername;Password=myPassword;
- Data Source: The name or IP address of the Oracle server and the port.
- User Id: Specifies the username for authentication.
- Password: Specifies the password for authentication.
Replace each field with your actual Oracle database server credentials and connection details.
Output parameters
Designer mode label | Script mode name | Accepted variable types | Description |
---|---|---|---|
Connection | connection | Database Connection |
Variable that stores the connection to the Oracle database. |
Example
This example connects to an Oracle database, by using the Assert Condition (assert
) command to verify whether the connection was successful. The message "Could not connect to the Database!"
is displayed if the connection is empty.
defVar --name dbConnection --type DbConnection
// Connect to the database via the connection string and store the data in the connection variable.
oracleConnect --connectionstring "Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;\r\nIntegrated Security=no;" dbConnection=connection
// Check if the connection was successful
assert --message "Could not connect to the database!" --left "${dbConnection}" --operator "Is_Null" --negate