Batch Insert Adapter Output

Hi,

I have used Batch Insert Adapter with output field as rows. I face issues while inserting records into DB. I get the number of inserted rows as -2.

Can anyone suggest a solution.

I assume you are on version 9 and above. Even I have encountered this behavior during some of my training’s. But you will not face any issue while inserting batch data in db.

I guess there should be some fix level for this. What is your current fix level of JDBC adapter?

1 Like

Hi Mahesh,

Yes, i’m using webMethods version 9.0.

Hi,

What is your current fix level of JDBC adapter specific?

HTH,
RMG

My question was not fully answered :slight_smile:

I have analysed and found this behaviour is normal and as per the design. Have a look at the below link: and look for Update Counts in the Oracle Implementation of Standard Batching

It says

“For a prepared statement batch, it is not possible to know the number of rows affected in the database by each individual statement in the batch. Therefore, all array elements have a value of -2. According to the JDBC 2.0 specification, a value of -2 indicates that the operation was successful but the number of rows affected is unknown.”

http://docs.oracle.com/cd/E11882_01/java.112/e16548/oraperf.htm#JJDBC28757

1 Like

You can get the size of the count list (variable) and this will tell you the number of rows inserted via batch insert adapter service.

If we are getting Reult Count -2 in every -Ngv Case.

Since exact count of update is needed. So i have decided to write a Java code service for batch update and found that this is limitatin of oracle and it does not support of getting the count in case of batch update using " Prepared statement interface". So i getthe Idea that SAG has implemented JDBC Bactch update Adapter serice using “Prepared statement interface”.

Did you check to get the size of the count list (variable) and this will tell you the number of rows updated via batch update adapter service.

If you batch operation, you will result with an array and “-2” if success. Just count this array by looping and checking value as “-2” which gives you what you need.

Thanks,

What is the result output type you have selected Integer or string in this case of the batch insert AS?

HTH,
RMG