Connet Mysql with Raspberry Pi OPC UA server

Questions regarding the use of the ANSI C SDK for Server or Client development or integration into customer products ...

Moderator: uasdkc

Post Reply
samboy
Jr. Member
Jr. Member
Posts: 4
Joined: 11 Jun 2014, 20:31

Connet Mysql with Raspberry Pi OPC UA server

Post by samboy »

Hello every, hello support team,

now I have some mySQl tables with history data and I am trying to connect one OPC UA server with mysql database. The goal is to using UaExpert to visit the OPC UA server on Raspberry Pi and get the history data from the database.

My idea is to write some codes about connecting database in the uaserver main function and then use mysql command such as SELECT ....FROM ....WHERE...IP=....

I did try to write one connection in the uaserver in the folder: examples\piface\applications\uaserverc_piface\linux but it didn't work. In the other topic I have asked about if this uaserver.c is the right one to work with.(the topic: http://forum.unified-automation.com/topic1284.html)

Here in this topic, I would like to see, if someone has any ideas about this design. Could anybody give me any suggestions or advice? Actually I am new in this field. I am not sure if this design is right or not. Besides, I haven't found a Variable type suitable to this work, for example array. Maybe because I am too fresh :-)

Thanks a lot for your answers and advice in advance.

samboy


the code I wrote in uaserver.c

User avatar
Support Team
Hero Member
Hero Member
Posts: 2532
Joined: 18 Mar 2011, 15:09

Re: Connet Mysql with Raspberry Pi OPC UA server

Post by Support Team »

Hello samboy,

the ANSI C Demoserver already has some simple example for demonstrating how to build up historic data in a "file". You should digg into that example and attach the mysql database instead of the file based storage used by our example, this functionality is capsulated in the so called "datalogger module".

To understand the concepts please make yourself familiar with:
http://documentation.unified-automation ... rted7.html
and
http://documentation.unified-automation ... Server_HDA

Best Regards
Support Team

Post Reply