Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

INSERT error in SERVER connection type

Help
chao jing
2010-12-15
2014-01-19
  • chao jing
    chao jing
    2010-12-15

    I use hsql in server way to run, and i use java JDBC client to connect. But sometimes it throw exception when i insert or update data.Exception message like this "java.sql.SQLException: transaction rollback: serialization failure". I use transaction in my code.
    How this exception cause by? And any suggestions??I have no idea. This question is important for me, please reply as soon as possible, Thank you very much~

     
  • chao jing
    chao jing
    2010-12-15

    this is whole exception stack message.
    Caused by: java.sql.SQLException: transaction rollback: serialization failure
    at org.hsqldb.jdbc.Util.sqlException(Util.java:223)
    at org.hsqldb.jdbc.JDBCPreparedStatement.fetchResult(JDBCPreparedStatement.java:4629)
    at org.hsqldb.jdbc.JDBCPreparedStatement.execute(JDBCPreparedStatement.java:1101)
    at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:100)
    at org.logicalcobwebs.proxool.ProxyStatement.intercept(ProxyStatement.java:57)
    at $java.sql.PreparedStatement$$EnhancerByProxool$$b300ca78.execute(<generated>)
    My hsql version is lastest

     
  • Fred Toussi
    Fred Toussi
    2010-12-15

    This exception is caused by multiple updates on the same object (in MVCC mode), or by deadlock prevention (in all modes). It really depends on what your different transactions are doing.

     
  • chao jing
    chao jing
    2010-12-18

    Thank you.
    I have two thread, first one insert value, last one will update value what insert before.
    Sometimes this excpetion occur when i insert data in transaction, in the transaction i insert data into two tables.these is the same cause of ?? How can i avoid this exception? change transaction level ?

     
  • Fred Toussi
    Fred Toussi
    2010-12-18

    It is difficult to say without knowing your application. With MVCC, the INSERT thread shouldn't have a problem at all. The update thread can update the rows when the INSERT thread has committed.

    In LOCKS mode, if you insert into two tables, the transactions must insert and update the tables in the same order, for example table A first, then table B.

     
  • chao jing
    chao jing
    2010-12-21

    I think I find the problem, thank you very much

     
  • FHaselbein2
    FHaselbein2
    2011-06-01

    Hello JingChao,
    I'm having the same problem, in a webapplication where users concurrently execute actions (e.g. save objects they are editing).
    How did you solve the problem?
    Bye Michael

     
  • MadKroLL
    MadKroLL
    2013-05-22

    +1
    How did you solve the problem? What was the cause?