Accessing Bamboo's H2 embedded database
Purpose
While the H2 database is not supported for production environments, sometimes admins will need access for testing purposes. The most likely use case is to get into an instance where you are locked out. You can access H2 through a Database Administration tool, Java GUI, or through the command line.
Connect to the embedded H2 database using DB Visualizer
If you need to make changes directly in the database, and you're using the H2 database, here's how you can connect to it using DBVisualizer.
DBVisualizer is just one database administration tool. You can use any administration tool that supports embedded H2 databases. The steps will be similar.
- Shut down Bamboo.
- Back up your
<bamboo-home>/database
directory. - Launch DBVisualizer
Add the H2 db driver which is embedded in Bamboo installer:
Go to Tools >> Driver manager
Locate the driver H2 embedded
Add a new driver file path to <Bamboo_Install>/lib/h2-1.4.xxx.jar
Move the driver to the top of the list
- Choose Create new database connection and follow the prompts to set up the connection.
The information you'll need is:- Database driver: H2 embedded
- Database Userid: sa
- Database password: leave this field blank
- Database filename:
<bamboo-home>/database/h2
leave off the.h2.db
file extension.
- Connect to the database.
Refer to the DBVisualizer documentation for help using DBVisualizer.
Connect to the embedded H2 database using Java GUI
Locate the H2 .jar file (h2-1.4.x.jar
) in your Bamboo installation directory:
<BAMBOO_INSTALL>/atlassian-bamboo/WEB-INF/lib/
From that folder, launch the GUI interface by entering the following command:
java -jar h2-1.4.194.jar
This will result in a browser opening, and you will be presented with a UI which looks something like this:
Enter the JDBC URL field using the string found in the "hibernate.connection.url" property in <bamboo-home>/bamboo.cfg.xml
For example:
<property name="hibernate.connection.url">jdbc:h2:${bambooHome}/database/h2</property>
Replace the {bambooHome} variable with the real path to the bamboo-home folder
jdbc:h2:file:/real/path/to/your/<bamboo-home>/database/h2
The default credentials are:
User Name | Password |
---|---|
sa | None (leave blank). |
Connect to the embedded H2 database using Command Line
Locate the H2 .jar file (h2-1.4.x.jar
) in your Bamboo installation directory:
<BAMBOO_INSTALL>/atlassian-bamboo/WEB-INF/lib/
From that folder launch the command line interface by entering the following command:
java -cp h2-1.4.194.jar org.h2.tools.Shell
You will be prompted to enter the following database URL, JDBC driver, user name, and password:
URL | JDBC Driver | Username | Password |
---|---|---|---|
The <url> string from <bamboo-home>/bamboo.cfg.xml - see example above. | org.h2.Driver | sa | None (leave blank, sometimes you will have to hit enter twice) |
If successful, you should be presented with a sql>
prompt, and can run any queries needed.