Knowledge Base

Select a category
Select a topic

Configuration of 'Database' components for accessing MySQL database

Purpose

This topic provides information about how to use the TruBot Designer Database components namely Connect and Execute Query to connect to MySQL database and execute a query respectively.

Prerequisites

  1. Connector/ODBC 8.0 and Connector/Net 8.0 must be installed on the machine where the TruBot Designer is installed. This enables access to the provider MySQL.Data.MySqlClient via the Connect and the Execute Query components.

  2. A Windows based MySQL client application through which MySQL database can be accessed. For example, MySQL WorkBench, DBeaver, etc.

Procedure

Step 1:  Open MySQL WorkBench, and then go to Database > Manage Connections. This opens the Manage Server Connections dialog. In the dialog, select the connection that you want to use for accessing the MySQL database via the Designer components.

In the image below, the connection selected is ConnectDB.

Step 2:  In the Manage Server Connections dialog, go to the Connection tab and select the connection method as Standard (TCP/IP) if it is not already selected. Again, in the Connection tab, go to the Parameters tab and by using the displayed parameter values, write a connection string in Notepad similar to shown below.

"server=127.0.0.1,3306;uid=root;pwd=Parker@123;database=world”

Note

  1. Except the database name and the password, all other values are available in the Connection tab for forming a connection string.

  2. In the Connection tab, you can test the connection using the displayed parameters by clicking Test Connection.

 

Step 3:  Open the TruBot Designer, and then create a workflow as displayed in the below image.

In the above workflow, first a connection is established with MySQL database (using the Connect activity), and then a query is executed (using the Execute Query activity), whose output is provided to the Output DataTable activity in a DataTable variable. The activity converts the DataTable instance stored in the variable to text and stored in the result variable. The text is displayed using the WriteLine activity. The properties for each activity are set in the subsequent steps.

Step 4:  Select the Connect activity and double-click to view its details. Set the value of the Connection String property using the connection string that you had formed using the Notepad. Next, open the Provider drop-down and select MySql.Data.MySqlClient.

Now, open the Properties pane to view all the properties of the Connect activity. Create and assign dbConnection variable to the DBConnection property.

Step 5:  Set the properties of the Execute Query, the Output DataTable and the WriteLine activities as shown in the below slideshow.

.

Note: The query should be based on the data stored in the database

The 'Execute Query' activity

The 'Output DataTable' activity

The 'WriteLine' activity

Step 6:  Go to the Test tab and run the activity. The output displayed is shown below.

Output in TruBot Designer

Query result using MySQL Workbench

Adding a user account in Google Authenticator

To add a user account in Google Authenticator:

  1. Open the link below and sign-in using your Google account credentials.

    https://myaccount.google.com/signinoptions/two-step-verification

    The 2-step Verification page opens.

  2. On the page, turn on two-step verification option, if not already.

  3. Scroll down and select Add Authenticator app. The Authenticator app page opens.

  4. On the page, select Set up authenticator. A dialog displaying a QR code opens.

  5. Before scanning the QR code, select Cant' scan it? to get access to the security key.

    Note down the email address and the security key associated with it, and save it in a secure place so that it is not compromised. You can use the security key information for configuring TruBot Designer's multi-factor authentication activities later.

  6. Click Back to access the QR code again. Follow the instructions given in the dialog i.e., open the Google Authenticator app and tap +, and then choose Scan the QR code to scan the QR code. A entry related to the user's account gets added in the app. Tap the entry to get access to the token for the user account in real time.