AC500 to MySQL
Hi guys, I have a question regarding communication btw AC500 and MySQL Server. I tried this example from library:
but I have a problem. I am able to make a connection between PLC and MySQL Server but when I send some MSEXEC statement (for example to create DB if it doesn't exist - step 10 in the example from library) the execution is stopped because PLC doesn't receive any answer from the server and also DB is not created in MySQL Server even if I see some activity during monitoring of it. Do you have any idea what could be the problem? For me it looks like there is wrong statement string received by the Server because there is some request comming but Server doesn't understand it. I don't know how to see this command in the Server but I will try to find it. If somebody can help me I would appreciate it.
Voted best answer
The example code is pretty simple and doesn't cover all situations. Specifically I dont think its very good at handling MySQL errors - which you seem to have found out :)
Most likely your process doesnt have the required privilege to create a MySQL database. And probably it shouldnt. You dont want to run the risk of a PLC program bug creating MySQL databases and tables that it shouldnt. Your best solution might be to monitor for a timeout in the PLC ( which could be caused by all sorts of things, not just an MSEXEC failure ) and recover from that gracefully.