Confluence throws an 'Invalid object name BANDANA' error
Problem
Confluence does not start. The database may have been cloned for use in a test/staging environment.
The following appears in atlassian-confluence.log
:
2015-01-13 11:10:32,717 ERROR [main] [atlassian.confluence.plugin.PluginFrameworkContextListener] contextInitialized Error initialising plugin manager: Hibernate operation: Could not execute query; bad SQL grammar []; nested exception is java.sql.SQLException: Invalid object name 'BANDANA'.
org.springframework.jdbc.BadSqlGrammarException: Hibernate operation: Could not execute query; bad SQL grammar []; nested exception is java.sql.SQLException: Invalid object name 'BANDANA'.
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:97)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.orm.hibernate.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:364)
Diagnosis
Environment
- Confluence is running against an MS SQL Server database.
Cause
The database user that is used to connect to the Confluence application is not mapped to the correct schema.
Resolution
- Log in to SQL Server Management Studio with an administrator account.
- Navigate to Confluence's Database > Security > Users in the drop down navigation.
- Select the database user used in Confluence.
- Right-click and go to Properties > General
Change the default schema for the user, via queries such as this:
ALTER USER <USER> WITH DEFAULT_SCHEMA = <SCHEMANAME>;
Replace <USER> with the SQL Server user's username (the one Confluence is connecting as), and <SCHEMANAME> with the name of the schema where Confluence tables are stored in
In most cases, switching the tables back to the default 'dbo' schema is preferred. If setting the default schema to 'dbo' doesn't work, please contact Support.