MYSQL CONNECTOR

Installation

Start by downloading the “MySQL” package available in the Apps Manager.

image002

Once the package has finished installing, the “mysql” node will be available in your Data Flow Manager. Drag and drop the node into your flow.

image003

Configuration

Double-click the node to open it.

image004

  • Database: Used to create a connection configuration to the MSSQL server.
  • Name: Changes the name of the node as shown in the Data Flows Manager. Has no effect on the query nor the connection.

To connect the node to the server, make sure that “Add new MySQLdatabase…” is selected in the Database field, and click the pencil icon next to it to start creating a new MySQL configuration.

image005

  • Host: The IP address or URL of the server being pulled from.
  • Port: The port number used by the server for connecting. 3306 is used as the protocol’s default.
  • User: The username of the service account used to access the server.
  • Password: The password of the service account used to access the server.
  • Database: The name of the database that data will be pulled from.
  • Timezone: Specifies the time zone of the data pulled. (Optional)

Keep in mind this restriction (which is available in the Help section of the node) with the mysql node when creating the service account for the connection:

image006

Once all the fields have been filled, the configuration should be all set. Click “Done” to save the node configuration and then “Deploy” at the top-right of the window to save your changes.

Querying the Node

The documentation that specifies how to query the mysql node is provided in the Help section of the node.

image007

msg.topic is used to carry the query to the node, and the node returns the query results in msg.payload.

To generate the query in msg.topic, a function node will be required. Insert a function node before the mysql node. An inject node will also be required to trigger the flow at a regular interval (which can be configured inside the inject node). A debug node will also be required to see that data is being received (make sure it is enabled, which can be told based on the green box on the right of it, which should be as it is shown in the picture and can be changed by clicking it). Add the nodes and connect them as shown:

image008

Here is an example of what the code might look like inside the function node to configure the query:

image009

Since this is done in JavaScript code, code can also be added to make the query dynamic, such as querying certain/moving time frames.

Once the inject node has been triggered, the mysql node should have a green symbol and return some more msg’s that will appear in the debug window, assuming everything has been setup correctly.

Was this article helpful?

Powered by Zendesk