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

DB2

Supported Versions

Driver

IBM
Supported versions 4.16.53 and later
URL format jdbc:db2://host:port/database
Ships with Flyway Command-line No
Download Follow instructuctions on ibm.com
Default Java class com.ibm.db2.jcc.DB2Driver

SQL Script Syntax

Compatibility

  • DDL exported by DB2 can be used unchanged in a Flyway migration
  • Any DB2 SQL script executed by Flyway, can be executed by db2 (after the placeholders have been replaced).

Example

/* Single line comment */
CREATE TABLE test_user (
 name VARCHAR(25) NOT NULL,
 PRIMARY KEY(name)
);

/*
Multi-line
comment
*/

-- Placeholder
INSERT INTO ${tableName} (name) VALUES ('Mr. T');

-- SQL-PL
CREATE TRIGGER uniqueidx_trigger BEFORE INSERT ON usertable
	REFERENCING NEW ROW AS newrow
    FOR EACH ROW WHEN (newrow.name is not null)
	BEGIN ATOMIC
      IF EXISTS (SELECT * FROM usertable WHERE usertable.name = newrow.name) THEN
        SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'duplicate name';
      END IF;
    END;

-- Terminator changes
--#SET TERMINATOR @
CREATE FUNCTION TEST_FUNC(PARAM1 INTEGER, PARAM2 INTEGER)
  RETURNS INTEGER
LANGUAGE SQL
  RETURN
  [email protected]   
--#SET TERMINATOR ;
CREATE FUNCTION TEST_FUNC(PARAM1 INTEGER, PARAM2 INTEGER, PARAM3 INTEGER)
  RETURNS INTEGER
LANGUAGE SQL
  RETURN
  1;

Limitations

  • None

MySQL