These instructions will help you connect Bamboo to a MySQL 5.1 database.
(Neither MySQL 4.1 nor 5.0 are supported databases for use with Bamboo.)
Please note that 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.
このページの内容
1. Creating and Configuring the MySQL database
To connect Bamboo to an external MySQL database, you must first create and configure it. This database must be configured to use:
utf8character set encoding, instead oflatin1utf8_bincollation- the InnoDB storage engine
If your MySQL database server is configured to use a storage engine other than InnoDB by default (such as MyISAM), then if possible change it to use InnoDB. Otherwise, you can configure Bamboo's JDBC connection to your MySQL database so that any tables which 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:
mysql> CREATE DATABASE bamboo CHARACTER SET utf8 COLLATE utf8_bin; mysql> GRANT ALL PRIVILEGES ON bamboo.* TO 'bamboouser'@'localhost' IDENTIFIED BY 'password'; mysql> FLUSH PRIVILEGES; mysql> QUIT
This creates an empty MySQL database for Bamboo named bamboo.
注意:
bamboouser— the user account name for the Bamboo MySQL databaselocalhost— 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, please refer to the MySQL 5 documentation — Specifying Character Sets and Collations.
2. Connecting Bamboo to the MySQL database
Bamboo provides two ways to connect to a MySQL database — by using either JDBC or a datasource. JDBC is generally simpler and is the recommended method.
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 from the download site.
- ダウンロードした zip/tar.gz ファイルを解凍します。
- Copy the mysql-connector-java-5.1.XX-bin.jar file from the extracted directory to the
<Bamboo installation directory>/libdirectory (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-5.1.XX-bin.jar file to/wrapper/lib directory.<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 and choose the Custom Installation method.
- On the 'Choose a Database Configuration' page, choose External Database > MySQL 5.1 and click Continue. The 'Database Configuration' page will appear.
Ensure that Direct JDBC connection is selected and complete the following fields (as shown in the screenshot below):
Driver Class Name Type com.mysql.jdbc.Driver(if different from the default).データベース URL Type the URL where Bamboo will access your database (if different from the default). Your URL must include the autoReconnect=trueflag.- If you intend to use non-Latin characters in Bamboo, ensure that your URL includes the
useUnicode=trueandcharacterEncoding=utf8flags. - 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=InnoDBflag.
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 the
autoReconnect=trueflag 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, please see the MySQL documentation.
ユーザー名 Type the username that Bamboo will use to access your database. This is bamboouserdefined in section 1 (above).パスワード Type the password (if required) that Bamboo will use to access your database. This is passworddefined in section 1 (above). Leave this field blank if a password for the database user account was not specified.- If you intend to use non-Latin characters in Bamboo, ensure that your URL includes the
- Select Overwrite existing data if you wish Bamboo to overwrite any tables that already exist in the database.
Click Continue.
Screenshot: Setup JDBC Connection (MySQL)
Connect using a datasource
To connect Bamboo to a MySQL database 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=trueandcharacterEncoding=utf8flags, such that your database URL should look similar to:jdbc:mysql://localhost/bamboo?autoReconnect=true&useUnicode=true&characterEncoding=utf8If your MySQL database server is configured to use a storage engine other than InnoDB by default, also include the
sessionVariables=storage_engine=InnoDBflag 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, please 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.
On the 'Choose a Database Configuration' page, choose External Database > MySQL 5.1 from the list and click Continue. The 'Database Configuration' page appears.
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.
If
java:comp/env/jdbc/DataSourceNamedoes 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


7 Comments
Anonymous
Jan 28, 2013I had to deploy the mysql library to <Bamboo installation directory>/webapp/WEB-INF/lib, otherwise the driver class couldn't be found.Anonymous
Feb 05, 2013I also had to use <Bamboo installation directory>/webapp/WEB-INF/lib. Putting the file in <Bamboo installation directory>/lib did not work for me. Is this documentation just WRONG?
ArmenA
Feb 06, 2013Putting the file in <Bamboo installation directory>/lib is the way Bamboo is designed to work.Can you please raise a new ticket and provide your Bamboo logs after reproducing the problem? Are you using the stand alone or WAR distribution?
Armen
Tim Drisdelle
Feb 19, 2013I had the same experience.
When I put the connector jar in <bamboo installation directory>/lib the setup did not find it.
When I moved the jar into <bamboo installation directory>/WEB-INF/lib it worked like a charm.
I'm using the WAR distro.
ArmenA
Feb 21, 2013Hi Tim, can you please open a new support ticket, reproduce the misbehavior (by having the MySQL jar file in the BAMBOO_INSTALL/lib directory only), and attach Bamboo logs for further investigation? By the way, you don't have the MySQL jar added to Tomcat (to
$CATALINA_HOME/common/libas per this page), do you?Armen
Tomas Cirip
Nov 04, 2013The same problem with <Bamboo installation directory>/webapp/WEB-INF/lib. I used RHEL6, Bamboo 5.2 build 4003 - 17 Oct 13.
ArmenA
Nov 06, 2013Hi Tomas,
For Bamboo 5.2 the MySQL jar file should be copied into the BambooInstall/lib directory (NOT into <Bamboo installation directory>/webapp/WEB-INF/lib as Bamboo gets shipped with embedded Tomcat since version 5.1, and the directory structure is a little bit different). You should see PostgreSQL jar in that same (BambooInstall/lib) directory too (it gets shipped).
Armen