Exception Occuredjava.sql.BatchUpdateException: ORA-00001: unique constraint

classic Classic list List threaded Threaded
3 messages Options
rajarshp rajarshp
Reply | Threaded
Open this post in threaded view
|

Exception Occuredjava.sql.BatchUpdateException: ORA-00001: unique constraint

Hi,

We were doing a POC(Ignite 2.3 - oracle) to check how cache Persistence Store works using writeBehind, We are updating data as a batch rather than updating one by one record.

though there are no duplication record but still getting "unique constraint" exception.

We couldnt find any root cause for this not sure is any issue if this is a possible ignite bug as this error is coming randomly. 

Also in another POC we have seen that it's not inserting all the data to the database.
For example we have pushed 10K but in Database we can only see 9800, though there is no error or exception.

could you please shade some lights on these issues ?

Sample Code:

for(int i=1;i<=100000;i++)
frstnm="test1name"+i;
scndnm="test2name";
p1 = new Person(i, frstnm, scndnm);
cache.put((long)i, p1);
 

insert into PERSON (id, firstname, lastname) values (?, ?, ?) 

inside write: 

st.setLong(1, val.getId());
st.setString(2, val.getFirstName());
st.setString(3, val.getLastName());
st.addBatch();
if(counter==100)
{
System.out.println("Counter "+ counter);
st.executeBatch();
counter=0;
}

got exception after 11K records 

Exception Occuredjava.sql.BatchUpdateException: ORA-00001: unique constraint ​

--
Regards,
Rajarshi Pain
rajarshp rajarshp
Reply | Threaded
Open this post in threaded view
|

Re: Exception Occuredjava.sql.BatchUpdateException: ORA-00001: unique constraint

Hello,

Can someone please help me on this scenario if somewhere I am making any mistake ?

Thanks,
Raj

On Fri, Jan 12, 2018 at 11:57 PM, Rajarshi Pain <[hidden email]> wrote:
Hi,

We were doing a POC(Ignite 2.3 - oracle) to check how cache Persistence Store works using writeBehind, We are updating data as a batch rather than updating one by one record.

though there are no duplication record but still getting "unique constraint" exception.

We couldnt find any root cause for this not sure is any issue if this is a possible ignite bug as this error is coming randomly. 

Also in another POC we have seen that it's not inserting all the data to the database.
For example we have pushed 10K but in Database we can only see 9800, though there is no error or exception.

could you please shade some lights on these issues ?

Sample Code:

for(int i=1;i<=100000;i++)
frstnm="test1name"+i;
scndnm="test2name";
p1 = new Person(i, frstnm, scndnm);
cache.put((long)i, p1);
 

insert into PERSON (id, firstname, lastname) values (?, ?, ?) 

inside write: 

st.setLong(1, val.getId());
st.setString(2, val.getFirstName());
st.setString(3, val.getLastName());
st.addBatch();
if(counter==100)
{
System.out.println("Counter "+ counter);
st.executeBatch();
counter=0;
}

got exception after 11K records 

Exception Occuredjava.sql.BatchUpdateException: ORA-00001: unique constraint ​

--
Regards,
Rajarshi Pain



--
Regards,
Rajarshi Pain
ezhuravlev ezhuravlev
Reply | Threaded
Open this post in threaded view
|

Re: Exception Occuredjava.sql.BatchUpdateException: ORA-00001: unique constraint

Hi,

As for 9800 entries instead of 10000 - most possible that you just have a small mistake when you work with your counter and these entries were not written to the DB: if(counter==100)

Anyway, for both problems community need additional information for an investigation. It would be great if you could share your full project with all configs and code, so the community can fast reproduce your issue and help you.

Evgenii


2018-01-14 10:32 GMT+03:00 Rajarshi Pain <[hidden email]>:
Hello,

Can someone please help me on this scenario if somewhere I am making any mistake ?

Thanks,
Raj

On Fri, Jan 12, 2018 at 11:57 PM, Rajarshi Pain <[hidden email]> wrote:
Hi,

We were doing a POC(Ignite 2.3 - oracle) to check how cache Persistence Store works using writeBehind, We are updating data as a batch rather than updating one by one record.

though there are no duplication record but still getting "unique constraint" exception.

We couldnt find any root cause for this not sure is any issue if this is a possible ignite bug as this error is coming randomly. 

Also in another POC we have seen that it's not inserting all the data to the database.
For example we have pushed 10K but in Database we can only see 9800, though there is no error or exception.

could you please shade some lights on these issues ?

Sample Code:

for(int i=1;i<=100000;i++)
frstnm="test1name"+i;
scndnm="test2name";
p1 = new Person(i, frstnm, scndnm);
cache.put((long)i, p1);
 

insert into PERSON (id, firstname, lastname) values (?, ?, ?) 

inside write: 

st.setLong(1, val.getId());
st.setString(2, val.getFirstName());
st.setString(3, val.getLastName());
st.addBatch();
if(counter==100)
{
System.out.println("Counter "+ counter);
st.executeBatch();
counter=0;
}

got exception after 11K records 

Exception Occuredjava.sql.BatchUpdateException: ORA-00001: unique constraint ​

--
Regards,
Rajarshi Pain



--
Regards,
Rajarshi Pain