AnsweredAssumed Answered

Possible JDBC Batch Update Issue

Question asked by chantry on Sep 28, 2016
Latest reply on Sep 28, 2016 by chantry

Greetings,

 

I am currently testing the JDBC driver's functionality with regards to batch updates. For my use case, there is a high possibility that some of the points being inserted will fail due to missing tag name configuration on PI.

 

One possible acceptable behaviour would be for PI to continue processing batch inserts after one of the inserts fail. This does not occur. In this case, Java's Statement.executeBatch command is supposed to throw a BatchUpdateException (which extends SQLException). From this exception it is possible to learn about the status and number of inserts of each command in the batch. The problem is that I seem to only be getting SQLExceptions. I checked whether the SQLException was an instance of a BatchUpdateException and it is not.

 

This leaves me with only two other possible options. The first would be to check that each tag exists in PI before attempting to insert into any data. This is not efficient, as it requires another query for every tag type I would like to insert. The second is to catch the SQLException and then parse the string error message, which is not only messy, but a likely point of failure in future updates.

 

Thoughts? Maybe this is configurable somewhere, but I'm not seeing anything in the documentation I'm reading.

Outcomes