How things work -jdbc driver and its limitation

hi
I heard that jdbc driver has limitation but I dont understand what it means it practice.
I thought the limitation is that when we use python code eg system.db.runPrepQuery it can execute only 1 instruction at the time. But my colleague created a query which contains 2 inserts to microsoft sql and executed runPrepQuery just once and it works ok. Could anybody please explain me what is actually the limitation of jdbc driver?

Regards

Whether a JDBC driver allows multiple statements or not depends on the particular JDBC driver implementation.

It sounds like the MSSQL JDBC driver at least allows multiple insert statements, assuming you’ve verified that they both resulted in new rows.

1 Like

many thanks for reply.
my colleague confirmed it worked ok with mssql. I will be conscience of the differences between jdbc drivers when working with other databases.

forgot to ask if it did not work do you think an error will be shown in obvious way or it might fail quietly ?

Sorry, no idea. I’d avoid doing driver-specific or “undefined behavior” things like this all together.

3 Likes

If you want to ensure multiple inserts happen together (and succeed or fail together), consider using a transaction, which is a JDBC supported feature:
https://docs.inductiveautomation.com/display/DOC81/system.db.beginTransaction

5 Likes