Cannot INSERT INTO MySQL with runPrepUpdate

hi, I write to you because I am having a problem with the system.db.runPrepUpdate script :

system.db.runPrepUpdate(“INSERT INTO test_cel(nombre,edad) VALUES(?,?)”,[‘Carolina’,31])

I don’t understand why it says me Invalid object name ‘test_cel’, this table exists and the name is correct.


Traceback (most recent call last):

File “event:actionPerformed”, line 1, in

java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(INSERT INTO test_cel(nombre,edad) VALUES(?,?), [Carolina, 27], , , false, false)

caused by Exception: Error executing system.db.runPrepUpdate(INSERT INTO test_cel(nombre,edad) VALUES(?,?), [Carolina, 27], , , false, false)
caused by GatewayException: SQL error for "INSERT INTO test_cel(nombre,edad) VALUES(?,?)": Invalid object name 'test_cel'.
caused by SQLServerException: Invalid object name 'test_cel'.

Ignition v7.6.3 (b2013090513)
Java: Oracle Corporation 1.7.0_03

Please help me to give a solution to this.

Thanks and Regards

Carito :frowning:

Is that table in the default database for the project? If not, you will have to specify the database name in the system.db.runPrepUpdate command.

Thank you very much, I forget it. It works Now!!

Regards

Carito :smiley:

Glad I could help you get it going, Carito. I forget simple things like that myself.