Run SQL commands against an HSQL database
About
Do not use an HSQL database for production. While this database is suitable for evaluation purposes, it is susceptible to data loss during system crashes. If you are looking to connect to a H2 embedded database, please refer to Accessing JIRA's H2 embedded database
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Purpose
On rare occasions, you may wish to run raw SQL queries on a JIRA application internal database which is used for evaluation purposes. This page describes how to obtain a SQL console for HSQLDB databases, which are built into JIRA applications for evaluation purposes.
Solution
Step 1: Locate HSQLDB directory How to obtain an HSQL Console
HSQL stores its database as text files in the filesystem. Typically these files will be in a database
subdirectory of your JIRA application Home Directory:
Step 2: Locate HSQLDB jar
The hsqldb jar file is located in the lib
sub-directory of the JIRA application Installation directory:
Step 3: Shut down your JIRA application
If you haven't already, shut down any apps using the database.
Step 4: Run The Console
Use the following command to bring up the HSQLDB console (replacing the JIRA_HOME
and JIRA_INSTALL
with the absolute paths)
Window:
java -cp "C:/Program Files/Atlassian/JIRA/lib/hsqldb-1.8.0.5.jar" org.hsqldb.util.DatabaseManager -user sa -url "jdbc:hsqldb:C:/Program Files/Atlassian/Application Data/JIRA/database/jiradb;shutdown=true"
Unix:
java -cp JIRA_INSTALL/lib/hsqldb-1.8.0.5.jar org.hsqldb.util.DatabaseManager -user sa -url 'jdbc:hsqldb:JIRA_HOME/database/jiradb;shutdown=true'
In versions of JIRA prior to JIRA 4.1 the jar file was in common/lib
The hsqldb console should load, listing tables in the database in the left panel. You can run SQL commands in the top panel:
Step 5: Shutdown The Console
Once you have finished running SQL queries, shut down the console before starting your JIRA application.
Troubleshooting
No tables are shown
If you can successfully bring up the console, but no tables are shown, the
jdbc:hsqldb:
the usual reasons are
- JIRA application/Confluence is still running. Ensure that the applications are shutdown before running the console.
- Path of the database file may be incorrect. You can update this by navigating to
File > Connect
and entering in the absolute path toJIRA_HOME/database/jiradb
in theURL box and clicking Ok.
Maybe you have an H2 embedded database (i.e. url is jdbc:h2:file:), please refer to Accessing JIRA's H2 embedded database .