system.db.runPrepUpdate syntax error

Hello Everyone,

I am newbie to ignition and with database. I have been trying to run the following script for my tables but it generates an error. I am using MySQL for my database. Any help or suggestion because I don’t what else to think of.

Thank you

Traceback (most recent call last):
File “event:actionPerformed”, line 25, in
UPDATE part_ref SET part_group = @@IDENTITY WHERE part_ndx = @@IDENTITY;
INSERT INTO tool_part_rel (tool_ndx, part_group) VALUES (? ,@@IDENTITY), [8980, 2], , , false, false)

Caused by: java.lang.Exception: Error executing system.db.runPrepUpdate(INSERT INTO part_ref (part_number,enabled) VALUES (?,1);
UPDATE part_ref SET part_group = @@IDENTITY WHERE part_ndx = @@IDENTITY;
INSERT INTO tool_part_rel (tool_ndx, part_group) VALUES (? ,@@IDENTITY), [8980, 2], , , false, false)
… 54 more
Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: SQL error for “INSERT INTO part_ref (part_number,enabled) VALUES (?,1);
UPDATE part_ref SET part_group = @@IDENTITY WHERE part_ndx = @@IDENTITY;
INSERT INTO tool_part_rel (tool_ndx, part_group) VALUES (? ,@@IDENTITY)”: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘UPDATE part_ref SET part_group = @@IDENTITY WHERE part_ndx = @@IDENTITY;
IN’ at line 2

Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘UPDATE part_ref SET part_group = @@IDENTITY WHERE part_ndx = @@IDENTITY;
IN’ at line 2

Lots of JDBC drivers don’t support SQL scripts. One statement at a time, using nothing but pure SQL.

1 Like