Want to deploy your JVM, Node.js and Go apps effortlessly to AWS? Try our service Boxfuse

Code: Database Setup

To run Flyway's entire test suite, you need to set up the databases Flyway supports.

For this you will need Oracle, MySQL, PostgreSQL, SQL Server, DB2 and EnterpriseDB.

Tip: If your feature/bug fix doesn't impact the DB-specific code
and you do not wish to set up all the databases, Flyway can be built using either:
  • mvn install -P-CommercialDBTest (skip Oracle, DB2 & SQL Server)
  • mvn install -P-InstallableDBTest -P-CommercialDBTest (skip all DBs, except in-memory ones)

This will disable all tests against the skipped DBs.

You can then omit installing them and continue to Submit your Changes.

Oracle

The best Oracle edition for development is the free XE. Grab your copy here: http://www.oracle.com/technetwork/database/express-edition/downloads/index.html

Install it with all the default settings and use flyway as the password for the system user.

After the installation is complete, execute sqlplus SYSTEM/flyway@XE. Commands:

-- Increase the number of concurrent connections
alter system set sessions=250 scope=spfile;
alter system set processes=250 scope=spfile;

-- Disable password expiry in Oracle 11g
ALTER PROFILE DEFAULT LIMIT FAILED_LOGIN_ATTEMPTS UNLIMITED PASSWORD_LIFE_TIME UNLIMITED;

Optionally you can also use these commands to disable Oracle XDB's http port (default: 8080) to avoid collisions with other tools:

begin
    dbms_xdb.sethttpport('0');
end;
/

Now, restart the database.

The Oracle Jdbc drivers aren't available from Maven Central. You need to download your copy of ojdbc6.jar here: http://www.oracle.com/technetwork/database/features/jdbc/jdbc-drivers-12c-download-1958347.html

Now rename the jar as ojdbc6-12.1.0.1.jar and add it to your local Maven repository under com/oracle/ojdbc6/12.1.0.1.

MySQL

Flyway supports MySQL 5.1 and later. You can grab the latest 5.1 version here: http://dev.mysql.com/downloads/mysql/5.1.html#downloads

Install it with the defaults, except for the following settings:

  • Online Transaction Processing
  • Include Bin Directory in PATH

Use flyway as the password for the root user.

If the configuration hangs, try again after turning off User Account Control.

MariaDB

Flyway supports MariaDB 10.0 and later. You can grab the latest 10.0 version here: https://downloads.mariadb.org/

Install it with the defaults, except for the following settings:

  • Root password: flyway
  • Use UTF8 as default server's character set
  • Service Name: MariaDB
  • TCP port: 3333

PostgreSQL

Flyway supports PostgreSQL 9.0 and later. You can grab the latest 9.0 version here: http://www.postgresql.org/download/

Install it with all the default settings and use flyway as the password for the postgres user.

After the installation is complete, add POSTGRESQL-INSTALL-DIR/bin to the PATH

If you have PostgreSQL on a different machine/VM you'll have to edit the pg_hba.conf file to allow connections from other machines than localhost:

E.g. edit C:\Programme\PostgreSQL\9.0\data\pg_hba.conf:

# TYPE  DATABASE        USER            CIDR-ADDRESS            METHOD
host    all             all             127.0.0.1/0		md5
see http://developer.postgresql.org/pgdocs/postgres/auth-pg-hba-conf.html

SQL Server

Flyway supports SQL Server 2008 and later. You can grab the latest free Express version with Management Tools here: http://www.microsoft.com/en-us/download/details.aspx?id=22973

Install it with the defaults, except for the following settings:

  • Authentication Mode: Mixed Mode
  • sa password: flyway
Tip for Windows XP installation:
If you install SQLServer under Windows XP, use the Network Service Account during installation for starting the SQL Engine, if you use Local Service the engine might not start

After the installation is complete, enable TCP/IP:

  • Launch the Sql Server Configuration Manager
  • Go to SQL Server Network Configuration -> Protocols for SQLEXPRESS
  • Enable TCP/IP
  • TCP/IP Properties -> IP Addresses -> IPAll
  • TCP Dynamic Ports: blank
  • TCP Port: 1433

Then enable remote access:

  • Launch the Sql Server Configuration Manager
  • SQL Server Services -> SQL Server Browser -> Properties -> Service Tab
  • Start Mode: Automatic
  • OK
  • SQL Server Browser -> Start
  • SQL Server -> Restart

The Microsoft SQL Server Jdbc drivers aren't available from Maven Central. So you'll need to add your copy of sqljdbc4.jar to your local Maven repository yourself.

Download the 4.0.2206.100 driver from here: http://www.microsoft.com/en-us/download/details.aspx?id=11774

Extract the archive, go to sqljdbc_4.0/enu and rename sqljdbc4.jar into sqljdbc4-4.0.2206.100.jar. Copy sqljdbc4-4.0.2206.100.jar to com/microsoft/sqlserver/sqljdbc4/4.0.2206.100 in your local Maven repository.

DB2

Flyway supports DB2 9.7.0.7 and later. You can grab the free Express edition here: http://www.ibm.com/software/data/db2/express/download.html

Install it with the defaults, except for the following settings:

  • Installation Type: Compact
  • Installation without saving a response file

Use flyway as the password for the db2admin user.

The DB2 Jdbc drivers aren't available from Maven Central. So you'll need to add your copy of db2jcc.jar to your local Maven repository yourself.

Download the 4.17.29 driver from here: https://www-304.ibm.com/support/docview.wss?uid=swg21363866

Extract the archive and then rename db2jcc4.jar into db2jcc4-4.17.29.jar. Copy db2jcc4-4.17.29.jar to com/ibm/db2/db2jcc4/4.17.29 in your local Maven repository.

Redshift

AWS Redshift is only available as a manged data warehouse service. Refer to https://aws.amazon.com/redshift/ for details. You can create a free AWS account at http://aws.amazon.com/free/, but Redshift itself is not available under the free usage tier. The cheapest Redshift instance currently costs $0.25 per hour (on-demand) or $999 per year (with a three-year reservation).

Create a new Redshift cluster using your AWS Management Console. Select "Redshift" from the home page in your AWS Management Console and click "Launch Cluster". Accept the defaults, except for the following:

  • Database Name: flyway
  • Master User Name: flyway
  • Master User Password: Flyway123
  • Node type: dw2.large (or whatever is currently the cheapest -- see https://aws.amazon.com/redshift/pricing/)
  • Cluster Type: Single Node

Now, create a tunnel to your Redshift server, so the that the unit tests can access Redshift from a port on your localhost. Following is an example on linux. This example assumes that your Redshift server's IP address is not publicly accessible, but is accessible from a "bastion host" that you have created within the same VPC. If your Redshift server is publicly accessible, replace "your-bastion-host" with "localhost" in the following command:

ssh -L 5439:your-instance-name.redshift.amazonaws.com:5439 your-bastion-host

Vertica

HP provides the Vertica community edition for development. Register at https://my.vertica.com/community/, then sign in and click the download link at https://my.vertica.com/download-community-edition/ to see the list of available files. Download the appropriate package of "HP Vertica 7.x.x Analytic Database Server Community Edition" for your operating system and also download the JDBC driver.

Installing the package will just copy files. On linux, the files will be copied to /opt/vertica. To configure Vertica, you also need to run the /opt/vertica/sbin/install_vertica script, as documented in the install guide: https://my.vertica.com/docs/7.0.x/PDF/HP_Vertica_7.0.x_Install_Guide.pdf.

Here is an example on linux:

sudo /opt/vertica/sbin/install_vertica --hosts localhost --deb vertica_7.0.1-0_amd64.deb --dba-user-password flyway

The Vertica Jdbc drivers aren't available from Maven Central. You need to download vertica-jdbc-7.0.0-0.jar from https://my.vertica.com/download-community-edition/. Please note that you must be logged in to download the Jdbc driver.

If you download a newer version, rename the jar as vertica-jdbc-7.0.0-0.jar. Copy vertica-jdbc-7.0.0-0.jar to your local Maven repository under com/vertica/vertica-jdbc/7.0.0-0.

solidDB

UNICOM provides a 30 day free trial for evaluation. Register and download at http://unicomsi.com/soliddb/register-soliddb-downloads.

Currently versions for Windows and Linux (both 32 and 64 bit) are available for trial download. For other operating systems you have to contact sales at UNICOM.

After installation you will find the JDBC driver in 'Program Files/IBM/solidDB/solidDB7.0/jdbc' for windows based installations. Install it in your local maven repository under com/ibm/SolidDriver/6.5.0.14_IF21 as SolidDriver-6.5.0.14_IF21.jar.

Sybase ASE

A developer version of Sybase ASE can be obtained at http://scn.sap.com/community/developer-center/oltp-db. You need to provide registration information in order to download it.

The current version supports both Windows and Linux 64-bit. For other operation systems please contact SAP.

To run Sybase tests, no special driver is needed as JTDS supports Sybase connection. Please amend flyway-mediumtests.properties to supply the username and password to connect to the testing database by using key sybase.user and sybase.password

EnterpriseDB

You will have to get a copy of EnterpriseDB: http://www.enterprisedb.com/products-services-training/products/postgres-plus-advanced-server/downloads

Install it with all the default settings and use flyway as the password for the enterprisedb user.

The EnterpriseDB Jdbc drivers aren't available from Maven Central. You can find them located in the "Connectors" directory, which by default will be "PostgresPlus/connectors/jdbc".

Now rename the jar as edb-jdbc17-9.5.6.jar and add it to your local Maven repository under com/edb/edb-jdbc17/9.5.6.

Greenplum

Greenplum DB can be obtained at https://network.pivotal.io/products/pivotal-gpdb.

The current version supports Mac OSX and Linux 64-bit.

To run Greenplum tests, no special driver is needed, as an option you can download Greenplum client from Pivotal website. Please amend flyway-mediumtests.properties to supply the username and password to connect to the testing database by using key greenplum.user and greenplum.password

Submit your Changes