Last updated by admin 2 years ago
grails install-plugin ibm-i
Last updated by fjorback 2 years ago
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 usage | Column type | Supplied user type |
|---|
| Date, YYYYMMDD | DEC(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 |
Last updated by admin 2 years ago
Last updated by fjorback 2 years ago
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.1Base 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 defaultWARNING: 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>