Incorrect database type specified
Symptoms
The following appears in the atlassian-jira.log
:
2005-02-10 12:24:33,307 [core.entity.jdbc.DatabaseUtil] SQL Exception while executing the following:
CREATE TABLE jiraaction (ID BIGINT NOT NULL, issueid BIGINT, AUTHOR VARCHAR, actiontype VARCHAR, actionlevel
VARCHAR, actionbody VARCHAR, CREATED TIMESTAMP, actionnum BIGINT, CONSTRAINT PK_jiraaction PRIMARY KEY (ID))
Error was: java.sql.SQLException: You have an error in your SQL syntax. Check the manual that corresponds
to your MySQL server version for the right syntax to use near ' actiontype VARCHAR, actionlevel VARCHAR, actionbody VARCHAR, C
2005-02-10 12:24:33,308 [core.entity.jdbc.DatabaseUtil] Entity "ChangeGroup" has no table in the database
2005-02-10 12:24:33,309 [core.entity.jdbc.DatabaseUtil] Could not create table "changegroup"
2005-02-10 12:24:33,309 [core.entity.jdbc.DatabaseUtil] SQL Exception while executing the following:
CREATE TABLE changegroup (ID BIGINT NOT NULL, issueid BIGINT, AUTHOR VARCHAR, CREATED TIMESTAMP, CONSTRAINT
PK_changegroup PRIMARY KEY (ID))
Error was: java.sql.SQLException: You have an error in your SQL syntax. Check the manual that corresponds to
your MySQL server version for the right syntax to use near ' CREATED TIMESTAMP, CONSTRAINT PK_changegroup PRIMARY KEY (ID))
2005-02-10 12:24:33,310 [core.entity.jdbc.DatabaseUtil] Entity "ChangeItem" has no table in the database
2005-02-10 12:24:33,310 [core.entity.jdbc.DatabaseUtil] Could not create table "changeitem"
Cause
JIRA needs to know what kind of database it will be using, in order to generate database tables of the correct data types, and to generate correctly formatted SQL. The database type is specified in the dbconfig.xml
file at the root of your JIRA Home Directory.
In the following example dbconfig.xml
, JIRA expects to use HSQLDB (JIRA's internal database used for evaluation purposes):
<?xml version="1.0" encoding="UTF-8"?>
<jira-database-config>
<name>defaultDS</name>
<delegator-name>default</delegator-name>
<database-type>hsql</database-type>
<schema-name>PUBLIC</schema-name>
<jdbc-datasource>
<url>jdbc:hsqldb:/path/to/jira/database/jiradb</url>
<driver-class>org.hsqldb.jdbcDriver</driver-class>
<username>sa</username>
<password></password>
<pool-size>15</pool-size>
<min-evictable-idle-time-millis>4000</min-evictable-idle-time-millis>
<time-between-eviction-runs-millis>5000</time-between-eviction-runs-millis>
</jdbc-datasource>
</jira-database-config>
Resolution
Installing JIRA
If you forgot to edit the dbconfig.xml
file (see the documentation), then follow these steps to recover:
1. Fix the database type in dbconfig.xml
Refer to the relevant documentation for your database in the Connecting JIRA to a Database section.
2. Fix the database
If this is the first time you have run JIRA, the database has been created incorrectly. Specifically, table columns have been created with incorrect data types. The solution is to
- Drop (delete) the database.
- Create the database again.
- Fix the database type in dbconfig.xml as in the previous section.
- Restart JIRA
When JIRA is restarted with the correct data type, the tables will be created correctly.
Upgrading JIRA
Since the newer version of JIRA may have added tables or columns with incorrect data types to your existing database schema, the safest solution is to do the upgrade again as follows:
- Create a new database
- Fix the database type in dbconfig.xml as in the previous section.
- Import an XML backup made before the upgrade.
In rare situations, if you cannot perform the upgrade again as above (for example, you have upgraded your production instance a few days back and it contains new data), it is possible to patch the database manually using 'ALTER TABLE
' SQL statements. Please review the log files for information on what types JIRA expects, and what is actually present. JIRA will print this information every time it starts up.
Other situations
If this is not the first time JIRA has loaded, and you are not upgrading, you probably do not need to fix the data. After fixing the dbconfig.xml
file, restart and check the logs for errors. If there are none, the database is fine.
Need help?
Please create a support request and attach the following:
- Compress/ZIP the startup logs from
$JIRA_HOME/log
- The current
dbconfig.xml
file - Any other relevant information