IBM i support

  • Tags : database, ibm i
  • Latest : 0.3
  • Last Updated: 27 May 2009
  • Grails version : 1.1 > *
  • Authors : null
0 vote
Dependency :
compile ":ibm-i:0.3"

Documentation

Summary

Installation

grails install-plugin ibm-i

Description

This plugin provides the library required in order to use DB2 for IBM i as your database server, including 3 convenient user types to use in your domain classes. The plugin requires the Hibernate plugin in order to compile the supplied user types.

Configuring DataSource.groovy

The plugin provides the script install-ibmi-datasource which will configure a new DataSource.groovy, ready for the IBM i platform. The existing DataSource.groovy is backed up as DataSource.groovy.bak.

Handling legacy columns

When dealing with IBM i legacy systems, you will often find columns defined without SQL data types, but through DDS instead. To map such legacy systems with Grails you will need to define user types within your domain classes. Example:
class Customer {
  …
  Date sinceWhen   // Use type Date as expected
  Boolean active      // Use type Boolean as expected
 …
  static mapping = {
    table 'LEGACY'
    columns {
      sinceWhen type: 'com.multisupport.util.grails.DecimalDate'
      active type: 'com.multisupport.util.grails.OneZeroBoolean'
    }
  }
}

Column usageColumn typeSupplied user type
Date, YYYYMMDDDEC(9 0)com.multisupport.util.grails.DecimalDate
Boolean, stored as '1' or '0'CHAR(1)com.multisupport.util.grails.OneZeroBoolean
Boolean, stored as 'Y' or 'N'CHAR(1)com.multisupport.util.grails.YesNoBoolean