How To Connect And Insert To Remote Database (SQL Connector)

Sx-io Device Connection to Remote Database:

  • Select “Modules” category from menu.
  • Select “SQL Connector” to connect remote database.

  • In “SQL Connector” page, click plus '+' button to add new remote database connection.

  • Name: Write any name that you like to describe remote database connection, for example “mysql_database_connection”
  • Comment: Write comment for connection (optional).
  • Type: Choose proper type for remote database connection. There are 3 types: Postgresql, MySQL and MS_SQL
  • Options: Set your database connection options in curly braces.

  • There is “Test Connection” button for test remote database connection.
  • If you want to test connection, click this button.
  • If connection successful, green connection message will appear.

  • Then click “Save” button to create remote database connection.

  • After added SQL Connector, click “SQL Insert Event” to create events for remote database.
  • Then click plus '+' button to add new “SQL Insert Event”.

  • In “Details” page for SQL Insert Event:
  • Name: Write any name that you like to describe SQL Insert Event, for example “Acyclic_Insertion_Event”
  • Comment: Write comment for event (optional).
  • Sql Insert Event Type: There are two event type: Cyclic and Acyclic.
  • Condition Eval String: Write your conditional eval string. Acyclic events depends “Condition Eval String”. Every change from false to true in this condition, a new insertion event will be created. If your event type is Cyclic, this area will be empty.

  • SQL Insert Event Cycle: If your event type is Cyclic, you have to choose a cycle for events. Cyclic events are created continuously with the selected time interval
  • SQL Connection: Choose proper connection for event, for example “mysql_database_connection”.
  • SQL Table Name: Write your table name that you want to insert events.
  • Insert Into Column Names: Write columns that will be effected insertion, you should write columns name in order.
  • Insert Into Values: This part will should be match with columns that you write above, you can use tag values or any value for column that will be accepted for insertion.
  • Max Buffer Hour: Write hours for buffer. After selected hour pass, historian events which pass this time will be deleted.
  • Allow Op Access: To allow op user to see record, tick the box.

  • Then click “Save” button to create new SQL Insert Event.

  • To see SQL Connector status, choose “Status” category from menu.
  • Click “SQL Connector”.
  • In this page, you can see your SQL Connector name, insert count, last message, last insert time and status.

  • To see created events from SQL Insert Event, choose “Historian” category from menu.
  • Click “SQL Insert Event”.
  • In this page, you can see Historian SQL Insert Events: timestamps, SQL event name, SQL connection name, SQL string,
  • Is Sent and Is Skipped. If event is successfully occur, Is Sent box will be ticked. If there is an issue with SQL Insert event, Is Skipped box will be ticked.
  • If your remote database not connected, historian events wait connection for insertion until max buffer hour passes.