PSQLException: current transaction is aborted, commands ignored until end of transaction block

前端 未结 20 1674
借酒劲吻你
借酒劲吻你 2020-12-04 06:51

I am seeing the following (truncated) stacktrace in the server.log file of JBoss 7.1.1 Final:

Caused by: org.postgresql.util.PSQLException: 
ERROR: current t         


        
相关标签:
20条回答
  • 2020-12-04 07:39

    In my case i was getting this error because my file was corrupt. While iterating the records of files it was giving me the same error.

    May be in future it will help to anyone. That's the only reason to post this answer.

    0 讨论(0)
  • 2020-12-04 07:40

    Change the isolation level from repeatable read to read committed.

    0 讨论(0)
  • 2020-12-04 07:40

    Set conn.setAutoCommit(false) to conn.setAutoCommit(true)

    Commit the transactions before initiating a new one.

    0 讨论(0)
  • 2020-12-04 07:43

    In Ruby on Rails PG, I had created a migration, migrated my DB, but forgot to restart my development server. I restarted my server and it worked.

    0 讨论(0)
  • 2020-12-04 07:45

    I just encounter the same error. I was able to figure out the root cause by enabling the log_statement and log_min_error_statement in my local PostgreSQL.

    I Referred this

    0 讨论(0)
  • 2020-12-04 07:48

    You need to rollback. The JDBC Postgres driver is pretty bad. But if you want to keep your transaction, and just rollback that error, you can use savepoints:

    try {
    _stmt = connection.createStatement();
    _savePoint = connection.setSavepoint("sp01");
    _result = _stmt.executeUpdate(sentence) > 0;
    } catch (Exception e){
     if (_savePoint!=null){
     connection.rollback(_savePoint);
    }
    }
    

    Read more here:

    http://www.postgresql.org/docs/8.1/static/sql-savepoint.html

    0 讨论(0)
提交回复
热议问题