Login required
Download

IBM i support

(0)
Author(s): Henrik Fjorback, Multi-Support
Current Release: 0.3
Grails Version: 1.1 > *
Tags database ibm i
grails install-plugin ibm-i
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

Running script install-ibmi-datasource

C:/Users/hf/grails_apps/ibmidb>grails install-ibmi-datasource
Welcome to Grails 1.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: C:/Programmer/Java/Grails-1.1

Base Directory: C:/Users/hf/grails_apps/ibmidb Running script C:/Users/hf/.grails/1.1/projects/ibmidb/plugins/ibm-i-0.2/scripts /InstallIbmiDatasource.groovy Environment set to development Warning, target causing name overwriting of name default

WARNING: This target will generate new grails-app/conf/DataSource.groovy. The existing configuration is renamed to DataSource.groovy.bak. Are you sure you want to continue? (y, n) y Do you want to configure the data source now? ([y], n)

Please enter the host name for the IBM i system: [ibmi.company.com] ibmi520.intercon.com Please enter the user name for the connection: [nn] grailsusr Please enter the password for the connection: [secret] topsecret Please enter schema (library) to use for development: [DEVLIB] DEV Please enter schema (library) to use for test: [DEV] TEST Please enter schema (library) to use for production: [DEV] PROD [move] Moving 1 file to C:/Users/hf/grails_apps/ibmidb/grails-app/conf [copy] Copying 1 file to C:/Users/hf/grails_apps/ibmidb/grails-app/conf DataSource configuration for IBM i installed. Now please review the ./grails-app /conf/DataSource.groovy C:/Users/hf/grails_apps/ibmidb>