Connect Bamboo to a MySQL database
This page describes how to connect Bamboo to a MySQL database.
このページの内容
The JDBC driver for MySQL 5.1 (JDBC Connector/J 5.1) is no longer bundled with Bamboo. You must download and install the driver yourself.
See Supported platforms for other information about the versions of MySQL supported by Bamboo.
1. Creating and Configuring the MySQL database
For your external MySQL database to work well with Bamboo, it must be able to use the following:
utf8
orutf8mb4
character set encoding instead oflatin1
utf8_bin
orutf8mb4_bin
collation- the InnoDB storage engine
(recommended, not required) lower_case_table_names=1
Setting lower_case_table_names=1 might break other Atlassian applications. For more information, see the steps.
- global transaction isolation level as READ_COMMITTED
- Disable NO_AUTO_VALUE_ON_ZERO mode.
We also recommend that your MySQL database server is configured to use an InnoDB storage engine. Alternatively, you can configure Bamboo's JDBC connection to your MySQL database so that any tables that Bamboo creates in this database will be done using the InnoDB database engine.
A MySQL database administrator can easily create and configure a MySQL database for Bamboo by running the following MySQL commands:
bamboouser
— the user account name for the Bamboo MySQL database. This creates an empty MySQL database for Bamboo named bamboo
, where:
localhost
— the host name of the MySQL database serverpassword
— the password for this user account
For more information about configuring character set encoding and collation for Bamboo MySQL databases, refer to the MySQL 5 documentation — Specifying Character Sets and Collations.
To verify if the NO_AUTO_VALUE_ON_ZERO mode is disabled, run this query on your MySQL server:
SELECT @@SQL_MODE, @@GLOBAL.SQL_MODE;
The first mode is the mode for the session, the second is the global settings for MySQL. If the global mode contains NO_AUTO_VALUE_ON_ZERO, it has to be removed as explained in the MySQL documentation.
2. Connecting Bamboo to the MySQL database
You can connect Bamboo to the MySQL in one of the following ways:
- using JDBC
- using a datasource
JDBC is generally simpler and we recommend using it.
Connect using JDBC
1. Download and install the JDBC driver
The JDBC drivers for MySQL Enterprise Server are no longer bundled with Bamboo (due to licensing restrictions). You need to download and install the driver yourself.
Download the MySQL Connector/J JDBC driver 5.1 or 8 from the download site.
In MySQL 8, the
com.mysql.jdbc.Driver
class implementingjava.sql.Driver
in MySQL Connector/J was deprecated. Instead, you should use thecom.mysql.cj.jdbc.Driver
class.- Extract the downloaded zip/tar.gz file.
- Copy the mysql-connector-java-XX.XX-bin.jar file from the extracted directory to the
<Bamboo installation directory>/lib
directory (create thelib/
directory if it doesn't already exist).
If you are using the Java Service Wrapper to start your Bamboo instance (Bamboo/wrapper/run-bamboo start
), copy the mysql-connector-java-XX.XX-bin.jar file to<Bamboo installation directory>
- Stop Bamboo on Windows, Linux, or Mac.
- Restart Bamboo on Windows, Linux, or Mac.
2. Connect Bamboo to a MySQL database using JDBC
- Run the Setup Wizard.
- On the 'Configure database' page, choose MySQL from the 'Database Type' dropdown menu, and then select Continue.
Ensure that Direct JDBC connection is selected and complete the following fields (as shown in the screenshot below):
Driver Class Name
Type:- com.mysql.cj.jdbc.Driver - for MySQL Connector/J 8.0 or later
- com.mysql.jdbc.Driver - for MySQL Connector/J 5.1
Database URL
Type the URL where Bamboo will access your database (if different from the default). Your URL must include theautoReconnect=true
flag.- If you intend to use non-Latin characters in Bamboo, ensure that your URL includes the
useUnicode=true
andcharacterEncoding=utf8
flags. If your MySQL database server is configured to use a storage engine other than InnoDB by default, ensure that your URL includes the
sessionVariables=storage_engine=InnoDB
flag.
If you include all of these flags, your Database URL should look similar to:jdbc:mysql://localhost/bamboo?autoReconnect=true&useUnicode=true&characterEncoding=utf8&sessionVariables=storage_engine=InnoDB
If theautoReconnect=true
flag is not specified, the MySQL JDBC driver will eventually time out and Bamboo will no longer be able to communicate with the database.
For more information on the URL syntax, see the MySQL documentation.If you use MySQL Connector 8.0 with MySQL database 5.7, AO tables will not be created and Bamboo will not be able to start. To prevent this, include the n
ullCatalogMeansCurrent=true
flag in your Database URL.
Your Database URL should look similar to:jdbc:mysql://instenv-2787-y7fe.c7uydxwwuprf.eu-west-1.rds.amazonaws.com:3306/bamboo?autoReconnect=true&useUnicode=true&characterEncoding=utf8&nullCatalogMeansCurrent=true
User Name
Type the username that Bamboo will use to access your database. This isbamboouser
defined in section 1 (above).
Password
Type the password (if required) that Bamboo will use to access your database. This ispassword
defined in section 1 (above). Leave this field blank if a password for the database user account was not specified.- Select Overwrite existing data if you wish Bamboo to overwrite any tables that already exist in the database.
Select Continue.
Connect using a datasource
Configure a datasource in your application server (consult your application server documentation for details). Please note the following:
Ensure that the JDBC URL which you configure in your application server includes the
autoReconnect=true
,useUnicode=true
andcharacterEncoding=utf8
flags, such that your database URL should look similar to:jdbc:mysql://localhost/bamboo?autoReconnect=true&useUnicode=true&characterEncoding=utf8
If your MySQL database server is configured to use a storage engine other than InnoDB by default, also include the
sessionVariables=storage_engine=InnoDB
flag in this URL.If the autoReconnect flag is not set, the MySQL JDBC driver will eventually time out and Bamboo will no longer be able to communicate with the database.
For more information on the URL syntax, see the MySQL documentation.Datasource example: You can see an example of using Tomcat with a MySQL database as a datasource in the following document: Tomcat and external MySQL datasource example.
Run the Setup Wizard and choose the Custom Installation method.
Choose External Database > MySQL from the list and click Continue.
Choose Connect via a datasource (configured in the application server) (as shown in the screenshot below).
In the JNDI name field, type the JNDI name of your datasource, as configured in your application server.
Ifjava:comp/env/jdbc/DataSourceName
does not work, tryjdbc/DataSourceName
(and vice versa).Select Overwrite existing data if you wish Bamboo to overwrite any tables that already exist in the database.
Click Continue.
Screenshot 2: Setup Datasource Connection