Calling Stored Procedure with Jdbc Adapter Local Connection

Hello everyone,

I am using Local Jdbc Connection to SQL database and one of the calls are through stored procedure which is executed successfully but then next batchInsert failes due to
Unable to invoke adapter service . Unable to connect to resource.The resource is already being used in a parent transaction.

Here what I am doing:

Basically I am processing Document with implicit transaction and if exception occurred Stored Procedure called explicitly, but procedure itself has start and end transaction. When I execute it first time it works OK, but in a next loop iteration after error occurred I can not invoke executeBatchInserts with error message above
Is it because I need to handle it with start/end transaction OR I have to use no transaction connection in this case

Please advise.
Any help appreciated

MainServiceLoop:
    TryDocumentProcessService 
       startLocalTransaction
          executeBatchInserts(many inserts in this block)     
       commitLocalTransaction
    CatchException   
       rollbackLocalTransaction 
       CallStoredProcedureToLogAnException   
endOfLoop      

Hi,
Use StartTransaction before loop.

startLocalTransaction
MainServiceLoop:
    TryDocumentProcessService 
          executeBatchInserts(many inserts in this block)     
       commitLocalTransaction
    CatchException   
       rollbackLocalTransaction 
       CallStoredProcedureToLogAnException   
endOfLoop      

Try it out. This should work.