# Verification on jdbc driver's response to handling duplicates

**URL:** https://community.cratedb.com/t/verification-on-jdbc-drivers-response-to-handling-duplicates/288
**Category:** SQL
**Created:** [October 15, 2019, 9:56pm UTC](https://community.cratedb.com/t/verification-on-jdbc-drivers-response-to-handling-duplicates/288 "2019-10-15T21:56:40Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![bputt](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/bputt/32/131_2.png) [@bputt](https://community.cratedb.com/u/bputt)
#### Post date: [October 15, 2019, 9:56pm UTC](https://community.cratedb.com/t/verification-on-jdbc-drivers-response-to-handling-duplicates/288/1 "2019-10-15T21:56:40Z")

</div>

I wanted to make sure we’re handling our logic for duplicate values correctly.

We’re using the JDBC driver and are batching ~500 records at a time and we’re looking at the response coming back to count the number of errors, success, and duplicates.

The question is whether or not the psuedo code below is an accurate representation on the response we’ll get back and whether or not an int=0 represents a duplicate.

```
Arrays.stream(rows).forEach(i -> {
    if (i >= 1) incrementSuccess();
    else if (i == 0) incrementDuplicates();
    else if (i == java.sql.PreparedStatement.SUCCESS_NO_INFO) incrementSuccess();
    else if (i == java.sql.PreparedStatement.EXECUTE_FAILED) incrementFailures();
    else incrementFailures();
});
```

---

<div class="post-metadata">

### Author: ![smu](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/smu/32/60_2.png) [@smu](https://community.cratedb.com/u/smu)
#### Post date: [October 24, 2019, 6:53am UTC](https://community.cratedb.com/t/verification-on-jdbc-drivers-response-to-handling-duplicates/288/2 "2019-10-24T06:53:23Z")

</div>

Yes this look accurate, although the row count could be 0 for other reasons like: no document found.

---

<div class="post-metadata">

### Author: ![bputt](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/bputt/32/131_2.png) [@bputt](https://community.cratedb.com/u/bputt)
#### Post date: [October 24, 2019, 9:43pm UTC](https://community.cratedb.com/t/verification-on-jdbc-drivers-response-to-handling-duplicates/288/3 "2019-10-24T21:43:54Z")

</div>

@smu is there a specific number that says they’re duplicates?

---

<div class="post-metadata">

### Author: ![smu](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/smu/32/60_2.png) [@smu](https://community.cratedb.com/u/smu)
#### Post date: [October 25, 2019, 6:53am UTC](https://community.cratedb.com/t/verification-on-jdbc-drivers-response-to-handling-duplicates/288/4 "2019-10-25T06:53:59Z")

</div>

@bputt No there isn’t, all execution errors are treated the same (= not increasing the row count).
