Database node is used to connect to external databases and perform various actions like select, insert, modify and other operations through stored procedures on the tables in external databases.
The supported databases are Oracle, PostgreSQL, MSSQL Databases.
Configuration for Database Node
- Click the Database node to open the attributes pane.
- In Configurations tab, enter the following details:
- Select either Jiffy server or Cluster for Run on from the drop-down.
- Enter the following details:
- Configuration Name: Name for the configuration.
- Type: Type of Database to connect to.
- Host: Name of the DB Server.
- Port: Port number in which DB is running to accept the incoming traffic.
- Database Name: Name of the database you wish to connect to.
- Username: DB username to connect to database.
- Password: Password of the DB user to connect to database.
Secure Vault keys can be used as username and password.
- Click the VALIDATE button to test if DB connection is successful.
- Once the connection is validated successfully, click the SAVE button to create the configuration.
Operations of Database Node
Details about the query to be executed by Database node is specified in the Operations tab. The following inputs are specified:
Operation
Three types of operations are possible:
- Select Statement: Retrieves records from database table that match the specified query.
To select all columns from a Customers table where LastName is Smith, the query would be:
SELECT * FROM Customers WHERE LastName = ‘Smith’;
- Update Statement: Modifies existing records in database table as per the specified query.
In the Employees table, to update the Salary to 10000 if the Expereince is greater than 1, the query would be:
Update Employees SET Salary = 10000 WHERE Expereince > 1;
You can write insert, create, update and alter queries here.
- Stored Procedure: Runs an existing stored procedure in the Database.
Provide the following details:
- Procedure Name as it exists in the DB server.
- Input parameters and Output Parameters as <name_of_param>|<type_of_param>.
Separate each parameter by space.
CustomerID|INT FirstName|VARCHAR
Specify the input and output parameters only if it is defined in the procedure.
Query
Query to be executed is specified in the Query field.
Parameters in the query can be passed in the following format:
- String values: ‘${String}’
- Integer values: ${Integer}
Processing Type
The SQL query or the Stored Procedure can be processed in two ways:
- Row Wise Processing: Records in the database are processed row by row.
Specify the following details:
- Row Limit: Output row limit. By default, it is set to 100.
- Columns in result set (space separated): Column names to display in the result set and must be space-separated.
This is mandatory and the specified column names should be the same as the name of the columns in the table.
- Iterate on this node’s output?: Toggle to ON, if you want to iterate on the output records.
Use Row Wise Processing when you need each row in the database to be fetched as an iteration for further automation.
- Bulk Processing: Records in the database are processed in bulk.
Specify the following details:
- Row Limit: Output row limit. By default, it is set to 100.
- Table Name: Select the DataTable to which you want the records to be written. Default DataTables and Custom DataTables created in the task will be listed in the dropdown.
To know more about Data tables, click here.
Use Bulk Processing when you need all the records in the database as a table for further automation.
Table Definition
All Default and Custom DataTables created in the task are displayed under the Table Definition tab.
Create the dataTable to write output of Bulk Processing operation, in case you want to use the Custom table in this tab.
Properties of the Database Node
- Navigate to Properties and enter Name and Description.
- Enable Mark run Failure on Node Fail and Continue on no result? options as required.
Result of Execution of Database Node
After executing the task, the Result of Execution window displays the following tabs:
- Input: The query executed is displayed.
- Output: If Row Wise Processing operation was performed in the node, output tab displays the result of the executed query consisting of columns selected in Columns in result set (space separated) field.
Click the Iteration # to see the details of each row.
- Run Info: The Run Details and Configuration Details are displayed.
- Run Details include Run ID, Sequence Number, Iteration ID, and Total Node Execution Time(in seconds).
- Configuration Details include Configuration Name, JDBC Driver Class, Username, and Config Level.
- Formatted Output: If Bulk Processing operation was performed in the node, Formatted Output tab displays the result set as a table.