Accessing Bamboo's H2 embedded database

Still need help?

The Atlassian Community is here for you.

Ask the community

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.

Bamboo must be shut down before accessing the H2 database. It is also highly recommended to back up your data before making any changes.

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.

  1. Shut down Bamboo.
  2. Back up your <bamboo-home>/database directory.
  3. Launch DBVisualizer
  4. Add the H2 db driver which is embedded in Bamboo installer:

    1. Go to Tools >> Driver manager

    2. Locate the driver H2 embedded

    3. Add a new driver file path to <Bamboo_Install>/lib/h2-1.4.xxx.jar

    4. Move the driver to the top of the list

  5. 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
      (warning) leave off the .h2.db file extension.
  6. 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>

(info) 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 NamePassword
saNone (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:

URLJDBC DriverUsernamePassword
The <url> string from <bamboo-home>/bamboo.cfg.xml - see example above.org.h2.DriversaNone (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.










Last modified on Oct 25, 2019

Was this helpful?

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