News:

  • April 30, 2026, 01:17:18 PM

Login with username, password and session length

Author Topic: SQL Noob in need of help  (Read 13737 times)

nprsut

  • Newbie
  • *
  • Posts: 1
SQL Noob in need of help
« on: December 27, 2022, 03:35:16 PM »
Hello all,
I am looking to send data into a SQL database on my PC from a BRX PLC over Ethernet. I have zero experience with SQL and am looking for guidance on setting up a database and sending data such as timestamps to that database. Please share any links you know that would help me understand how to achieve this goal. Thank you all very much for any help you can provide.

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: SQL Noob in need of help
« Reply #1 on: December 27, 2022, 06:42:07 PM »
Hello all,
I am looking to send data into a SQL database on my PC from a BRX PLC over Ethernet. I have zero experience with SQL and am looking for guidance on setting up a database and sending data such as timestamps to that database. Please share any links you know that would help me understand how to achieve this goal. Thank you all very much for any help you can provide.

Writing to a database from the BRX can't be done directly. What type of budget do you have, what other tools/hardware/software are you currently in possession of? How much data are you looking at writing? How extensible does this need to be? Are you looking for future expansion? What is your main objective? There are a number of ways to do this depending on what you already have available, your short/long-term goals, your support structure and time/money budget.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6154
  • Yes Pinky, Do-more will control the world!
Re: SQL Noob in need of help
« Reply #2 on: December 28, 2022, 12:11:57 PM »
Hello all,
I am looking to send data into a SQL database on my PC from a BRX PLC over Ethernet. I have zero experience with SQL and am looking for guidance on setting up a database and sending data such as timestamps to that database. Please share any links you know that would help me understand how to achieve this goal. Thank you all very much for any help you can provide.

Many SQL databases have REST API extensions. BRX can definitely write to ones that do.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Bolt

  • Hero Member
  • *****
  • Posts: 595
Re: SQL Noob in need of help
« Reply #3 on: December 29, 2022, 10:15:57 AM »
Hello all,
I am looking to send data into a SQL database on my PC from a BRX PLC over Ethernet. I have zero experience with SQL and am looking for guidance on setting up a database and sending data such as timestamps to that database. Please share any links you know that would help me understand how to achieve this goal. Thank you all very much for any help you can provide.
This can be done a variety of ways. It's not super beginner level, but not super hard either, as there are countless tutorials on youtube, etc to get you going. You could install XAMPP on your PC, and that would get you a MariaDB SQL along with an Apache web server. You could use simple web scripts in PHP to post the data streams to the DB, which is how I did it last time the need arose. Or, like BobO said, I'm sure there's REST API capabilities by now, and that would negate the need to learn PHP methods.

The underlying concept I can suggest is to put all your data in a FIFO queue on the PLC (or a simple array and have a ToPost bit to show that it still needs to be uploaded) and from there grab the data strings and post them to the DB.  Based on the DB server's response code, you can then determine if it was successful and move to next one, error and retry, or error and discard and move on to the next one.

jcb

  • Full Member
  • ***
  • Posts: 41
Re: SQL Noob in need of help
« Reply #4 on: December 29, 2022, 03:36:36 PM »
I have always used Red Lion Data Stations and Graphite Controllers for this. It looks like they sell a new FlexEdge Controller now, but I don't have experience with those.

The DSP and Graphite Edge controllers are rock solid and have SQL Sync so if the SQL computer is offline the controller will update the table with the newest data when in is back online. They also can provide you with notifications via Email/SMS and a host of other things. They can grab data from almost any PLC and log it to Microsoft SQL as well as a CSV file on the SD/CF Card.

I have used them for 10+ years to log to SQL for my Critical Alerts, PM trends and Production tracking systems.

They are not cheap but if you have a need this is what I recommend from experience.


John.
« Last Edit: December 29, 2022, 03:49:49 PM by jcb »

Kristjan

  • Sr. Member
  • ****
  • Posts: 79
    • Idnadartaekni ehf
Re: SQL Noob in need of help
« Reply #5 on: December 29, 2022, 05:00:38 PM »
You may be looking for a SCADA system. Or did you already consider and/or rule out that option?

Many SCADA systems have multiple subsystems for data logging, alarm handling and logging etc. I am using Iconics Genesis64 for all my SCADA needs and there you also have all kinds of data connectors, data bridging solutions and more. So to log PLC data to SQL, I would set up an OPC server between the PLC and the SCADA and then I would have the SCADA periodically log data through OPC.