Troubleshooting SQL Exceptions

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

If you get an exception similar to those shown below, it is a good idea to increase the logging levels of your Confluence instance. If you request Atlassian support, this additional logging will help us work out the cause of the error.

Increased logging levels will enable us to diagnose errors like these:

org.springframework.dao.DataIntegrityViolationException: (HibernateTemplate): data integrity violated by SQL ''; nested exception is java.sql.BatchUpdateException: Duplicate entry '1234' for key 1
 at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:88)
caused by: java.sql.BatchUpdateException: Duplicate entry '1234' for key 1
 at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:647) 

or

(HibernateTemplate): data integrity violated by SQL ''; nested exception is java.sql.BatchUpdateException: ORA-00001: unique constraint (CONFLUENCE.SYS_C0012345) violated

This document outlines the steps to take to increasing logging on your system.


Confluence 11.0 and later: logging is configured in log4j2.xml , and the log4j.properties  file is no longer read. Confluence 11.0 also uses a newer version of Hibernate, so the logger names in earlier versions of this page, such as net.sf.hibernate.SQL  and net.sf.hibernate.type , no longer produce any output. Use the logger names on this page instead.

Changing the logging levels via the Administration Console

With Confluence 2.7 and later, you can adjust logging levels at runtime via the Administration Console — read the instructions. Below we tell you how to edit the log4j files directly.

  1. Open confluence/WEB-INF/classes/log4j2.xml and find the following lines in the <Loggers>  section:
    <Logger level="error" name="org.hibernate.SQL" additivity="false">
      <AppenderRef ref="sqllog"/>
    </Logger>
    
    (info) If you can not locate these lines in your log4j2.xml file, please add them to the end of it.
  2. Change the level of org.hibernate.SQL  to debug , and add a new logger for org.hibernate.orm.jdbc.bind  directly after it: 
    <!-- log hibernate prepared statements/SQL queries (equivalent to setting 'hibernate.show_sql' to 'true') -->
    <Logger level="debug" name="org.hibernate.SQL" additivity="false">
      <AppenderRef ref="sqllog"/>
    </Logger>
    
    <!-- log hibernate prepared statement parameter values -->
    <Logger level="trace" name="org.hibernate.orm.jdbc.bind" additivity="false">
      <AppenderRef ref="sqllog"/>
    </Logger>
    Keep additivity="false"  and the <AppenderRef ref="sqllog"/>  line. They write the SQL logging to its own file, `atlassian-confluence-sql.log, rather than filling up the main application log. The parameter values are logged at `TRACE` level, which the main application log filters out by default.
  3. Restart Confluence.
  4. Redo the steps that led to the error.
  5. Zip up your logs directory and attach it your support ticket.
  6. If you are using Oracle and received a constraint error, please ask your database administrator which table and column the constraint (that is, CONFLUENCE.SYS_C0012345) refers to and add that information to your support ticket.
  7. Open confluence/WEB-INF/classes/log4j2.xml again and remove the 4 lines you added in step 1. (The additional logging will impact performance and should be disabled once you have completed this procedure.)
RELATED TOPICS

Enabling Detailed SQL Logging
Working with Confluence Logs
Troubleshooting failed XML site backups

Last modified on Oct 9, 2026

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.