Load Data from MySQL Database Block

You can use the Load Data from MySQL Database Block within the Chat flow to connect to any SQL database and perform a database query to inject within Dialogue text or other blocks available through variables.

Only MySQL database connection is supported for now, while we are working on other types of DB connections.

Using the Block

Select the Block and drop it onto the Canvas. You can find it under Integrate > Databases > Load Data from MySQL Database.

img

The block asks you to provide your database credentials so we can establish a connection to your database.

  1. Name: Please choose an internal name for your data connection.
  2. DB Hostname: Please provide the IP address or domain name of your database server.
  3. DB User: Make sure you have created a user that has access rights to your database and that we can use to connect your database to the Block.
  4. DB User Password: Type in the password corresponding to the username provided above.
  5. Name of the DB: Additionally we will need the actual name of your database to setup the connection.
  6. Enter SQL Query : You may type in the exact SQL query to be performed in this parameter. All the variables asked by the chatbot or global variables are available to you that can be used here.
  7. Save Result to: Name of the variable in which you wish to store the query response. Use these variables to call in any part of the chatbot conversation.

A good practice when using databases is to set the username, the password and the database name values at the beginning of the script code. If you need to change them later, this way you will be able to perform the change easily.

Use the Set Variable Block to hold the DB credentials. Here the DB Name 'mySQL1' is stored in 'dbname' variable.

img

And call the variables in the Load Data from MySQL Database Block as .

img

results matching ""

No results matching ""