# How can I save Prosys Simulation Server Data to MySQL Database using Node-RED?

**URL:** <https://discourse.nodered.org/t/how-can-i-save-prosys-simulation-server-data-to-mysql-database-using-node-red/14135>\
**Category:** General\
**Created:** [8 August 2019 09:51 UTC](https://discourse.nodered.org/t/how-can-i-save-prosys-simulation-server-data-to-mysql-database-using-node-red/14135 "2019-08-08T09:51:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sajidb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sajidb/32/8812_2.png) [@sajidb](https://discourse.nodered.org/u/sajidb)\
**Post date:** [8 August 2019 09:51 UTC](https://discourse.nodered.org/t/how-can-i-save-prosys-simulation-server-data-to-mysql-database-using-node-red/14135/1 "2019-08-08T09:51:44Z")

</div>

I have a simulation server (Prosys Simulation Server) and I want to save the data in MySQL database. I have already setup a local database.

I am using Node-RED for this task because node-red can be connected with Prosys Simulation Server and with MySQL database as well.

The problem I am facing is the inter-connection between the OPC UA client node and MySQL node.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [8 August 2019 10:53 UTC](https://discourse.nodered.org/t/how-can-i-save-prosys-simulation-server-data-to-mysql-database-using-node-red/14135/2 "2019-08-08T10:53:59Z")

</div>

so you can get your data into Node-RED?

If so you will need to create your SQL INSERT query either in a function node or the change node.

So which bit are you struggling with?

---

<div class="post-metadata">

**Author:** ![sajidb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sajidb/32/8812_2.png) [@sajidb](https://discourse.nodered.org/u/sajidb)\
**Post date:** [8 August 2019 11:58 UTC](https://discourse.nodered.org/t/how-can-i-save-prosys-simulation-server-data-to-mysql-database-using-node-red/14135/3 "2019-08-08T11:58:34Z")

</div>

> [@ukmoose](#):
>
> If so you will need to create your SQL INSERT query either in a function node or the change node.

How can I do that?

I am struggling with the function/change node.I don't know how to do that. Can you please help me?

Suppose I want to send the msg.payload with the current time to MySQL. How can I do that?

msg.payload, Now()

---

<div class="post-metadata">

**Author:** ![sajidb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sajidb/32/8812_2.png) [@sajidb](https://discourse.nodered.org/u/sajidb)\
**Post date:** [8 August 2019 12:12 UTC](https://discourse.nodered.org/t/how-can-i-save-prosys-simulation-server-data-to-mysql-database-using-node-red/14135/4 "2019-08-08T12:12:53Z")

</div>

I found a solution. I have done it like this. It's working.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/5bdd7bde922fecba7f52ca9d424a947308a7363c.png)

This is the text in template:

```auto
INSERT INTO test.prosys_table(Counter, Time) VALUES ('{{payload}}',Now());

```
