5 Replies Latest reply on Dec 28, 2014 11:32 AM by shiveeta.mattoo

    JDBC Translator | Queries on batch commit and Update Count

    shiveeta.mattoo

      Hi,

       

      Two questions related to functionality provided by JDBC Translator

       

      1. Segregation of batch execution and commit mode in JDBC Translator

       

      Currently we see that batch operations (Insert/Update) are processed as expected. However the batch execution and commit are coupled together. Hence, we only have the ability to commit after a batch completes. We are also seeking an ability to support the commit after a configurable 'x' no. of batches has completed, instead of an automatic commit after every batch.

       

      We have a similar batch transaction handling framework for an internal JDBC layer. In that we provide the user with an option to specify the no of batches after which a commit is desired.We are able to achieve the same with the base driver, because it does not automatically commit when we hit batch size. We are seeking a similar support from Teiid JDBC translator. Please advise.

       

       

      2. Update Count Reported on Batched Update Execution.

       

      Typically, the executeBatch() returns an array of integers, and each element of the array represents the update count for the respective update statement.

      However in case of JDBC Translator, over and above this, we are processing the array to return a sum of all the elements as in seen in JDBCUpdateExecution -> executeTranslatedCommand method

       

      int[] results = pstatement.executeBatch();

                             

      for (int i=0; i<results.length; i++) {

      updateCount += results[i];

      }

       

      Is there any specific reason to perform this? Can we change this to stick to the expected standard behaviour?

      Reason for requesting this, is that we have a generic DB access layer built on top of our virtualization layer, which expects the updatecount in a standard format.

      Instead of embedding some specific checks in our layer, I was keen to understand any definite need for the non-standard behaviour.

       

      Thanks for your help in advance

       

       

      Regards,

      Shiveeta