BCS SDK Manager Install

The Software Development Kit Manager

SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. It provides a convenient Command Line Interface (CLI) and API for installing, switching, removing and listing Candidates. Formerly known as GVM the Groovy enVironment Manager, it was inspired by the very useful RVM and rbenv tools, used at large by the Ruby community.

The zip and unzip applications must be installed prior to installing SDK manager.

sudo apt-get install zip
sudo apt-get install unzip

The SDK install can commence by issuing the following commands.

curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk version

At this point installations may commence.

sdk list
or
sdk list >> lst.txt

The following depicts the list of available candidates on this workstation.

================================================================================
Available Candidates
================================================================================
q-quit                                  /-search down
j-down                                  ?-search up
k-up                                    h-help
 
--------------------------------------------------------------------------------
Ant (1.10.1)                                             https://ant.apache.org/
 
Apache Ant is a Java library and command-line tool whose mission is to drive
processes described in build files as targets and extension points dependent
upon each other. The main known usage of Ant is the build of Java applications.
Ant supplies a number of built-in tasks allowing to compile, assemble, test and
run Java applications. Ant can also be used effectively to build non Java
applications, for instance C or C++ applications. More generally, Ant can be
used to pilot any type of process which can be described in terms of targets and
tasks.
 
                                                               $ sdk install ant
--------------------------------------------------------------------------------
AsciidoctorJ (1.5.6)                                     http://asciidoctor.org/
 
AsciidoctorJ is the official library for running Asciidoctor on the JVM. Using
AsciidoctorJ, you can convert AsciiDoc content or analyze the structure of a
parsed AsciiDoc document from Java and other JVM languages.
 
                                                      $ sdk install asciidoctorj
--------------------------------------------------------------------------------
Ceylon (1.3.3)                                           http://ceylon-lang.org/
 
Ceylon is a modern, modular, statically typed programming language for the Java
and JavaScript virtual machines. The language features a flexible and very
readable syntax, a unique and uncommonly elegant static type system, a powerful
module architecture, and excellent tooling.
 
                                                            $ sdk install ceylon
--------------------------------------------------------------------------------
CRaSH (1.3.0)                                            http://www.crashub.org/
 
The Common Reusable SHell (CRaSH) deploys in a Java runtime and provides
interactions with the JVM. Commands are written in Groovy or Java and can be
developed at runtime making the extension of the shell very easy with fast
development cycle.
 
                                                             $ sdk install crash
--------------------------------------------------------------------------------
Gaiden (1.1)                                       http://kobo.github.io/gaiden/
 
Gaiden is a tool that makes it easy to create documentation with Markdown.
 
                                                            $ sdk install gaiden
--------------------------------------------------------------------------------
Glide (0.9.2)                                      http://glide-gae.appspot.com/
 
Glide makes it incredibly easy to develop apps that harness the power of Google
App Engine for Java using expressiveness of Groovy and sweetness of Gaelyk's
syntactic sugar.
 
                                                             $ sdk install glide
--------------------------------------------------------------------------------
Gradle (4.4)                                                  http://gradle.org/
 
Gradle is a build automation tool that builds upon the concepts of Apache Ant
and Apache Maven and introduces a Groovy-based domain-specific language (DSL)
instead of the more traditional XML form of declaring the project configuration.
Gradle uses a directed acyclic graph (DAG) to determine the order in which tasks
can be run.
 
                                                            $ sdk install gradle
--------------------------------------------------------------------------------
Grails (3.3.2)                                               https://grails.org/
 
Grails is a powerful web framework, for the Java platform aimed at multiplying
developers productivity thanks to a Convention-over-Configuration, sensible
defaults and opinionated APIs. It integrates smoothly with the JVM, allowing you
to be immediately productive whilst providing powerful features, including
integrated ORM, Domain-Specific Languages, runtime and compile-time
meta-programming and Asynchronous programming.
 
                                                            $ sdk install grails
--------------------------------------------------------------------------------
Griffon (1.5.0)                                    http://griffon-framework.org/
 
Griffon is desktop application development platform for the JVM.Inspired by
Grails, Griffon leverages the use of the Groovy language and concepts like
Convention over Configuration. The Swing toolkit is the default UI toolkit of
choice however others may be used, for example JavaFX.
 
                                                           $ sdk install griffon
--------------------------------------------------------------------------------
Groovy (2.4.13)                                      http://www.groovy-lang.org/
 
Groovy is a powerful, optionally typed and dynamic language, with static-typing
and static compilation capabilities, for the Java platform aimed at multiplying
developers' productivity thanks to a concise, familiar and easy to learn syntax.
It integrates smoothly with any Java program, and immediately delivers to your
application powerful features, including scripting capabilities, Domain-Specific
Language authoring, runtime and compile-time meta-programming and functional
programming.
 
                                                            $ sdk install groovy
--------------------------------------------------------------------------------
GroovyServ (1.1.0)                            https://kobo.github.io/groovyserv/
 
GroovyServ reduces startup time of the JVM for runnning Groovy significantly. It
depends on your environments, but in most cases, it’s 10 to 20 times faster than
regular Groovy.
 
                                                        $ sdk install groovyserv
--------------------------------------------------------------------------------
Java (8u152-zulu)                                              https://zulu.org/
 
Java Platform, Standard Edition (or Java SE) is a widely used platform for
development and deployment of portable code for desktop and server environments.
Java SE uses the object-oriented Java programming language. It is part of the
Java software-platform family. Java SE defines a wide range of general-purpose
APIs – such as Java APIs for the Java Class Library – and also includes the Java
Language Specification and the Java Virtual Machine Specification.
 
                                                              $ sdk install java
--------------------------------------------------------------------------------
JBake (2.5.1)                                                  http://jbake.org/
 
JBake is a Java based, open source, static site/blog generator for developers
and designers.
 
                                                             $ sdk install jbake
--------------------------------------------------------------------------------
Kobalt (0.720)                                           http://beust.com/kobalt
 
Kobalt is a build system inspired by Gradle and Maven. It reuses the best
concepts from these two successful and popular build systems while adding a few
modern features of its own. Kobalt is written entirely in Kotlin and its build
files are valid Kotlin files as well.
 
                                                            $ sdk install kobalt
--------------------------------------------------------------------------------
Kotlin (1.2.0)                                           https://kotlinlang.org/
 
Kotlin is a statically-typed programming language that runs on the Java Virtual
Machine and can also be compiled to JavaScript source code.
 
                                                            $ sdk install kotlin
--------------------------------------------------------------------------------
kscript (2.2.1)                          https://github.com/holgerbrandl/kscript
 
Enhanced scripting support for Kotlin on *nix-based systems. kscript provides an
easy-to-use, very flexible, and almost zero-overhead solution to write
self-contained mini-applications with Kotlin.
 
                                                           $ sdk install kscript
--------------------------------------------------------------------------------
Lazybones (0.8.3)                        https://github.com/pledbrook/lazybones/
 
Lazybones allows you to create a new project structure for any framework or
library for which the tool has a template.
 
                                                         $ sdk install lazybones
--------------------------------------------------------------------------------
Leiningen (2.7.1)                                          http://leiningen.org/
 
Leiningen is the easiest way to use Clojure. With a focus on project automation
and declarative configuration, it gets out of your way and lets you focus on
your code.
 
                                                         $ sdk install leiningen
--------------------------------------------------------------------------------
Maven (3.5.2)                                          https://maven.apache.org/
 
Apache Maven is a software project management and comprehension tool. Based on
the concept of a project object model (POM), Maven can manage a project's build,
reporting and documentation from a central piece of information.
 
                                                             $ sdk install maven
--------------------------------------------------------------------------------
sbt (1.0.4)                                            http://www.scala-sbt.org/
 
SBT is an open source build tool for Scala and Java projects, similar to Java's
Maven or Ant. Its main features are: native support for compiling Scala code and
integrating with many Scala test frameworks; build descriptions written in Scala
using a DSL; dependency management using Ivy (which supports Maven-format
repositories); continuous compilation, testing, and deployment; integration with
the Scala interpreter for rapid iteration and debugging; support for mixed
Java/Scala projects
 
                                                               $ sdk install sbt
--------------------------------------------------------------------------------
Scala (2.12.4)                                        http://www.scala-lang.org/
 
Scala is a programming language for general software applications. Scala has
full support for functional programming and a very strong static type system.
This allows programs written in Scala to be very concise and thus smaller in
size than other general-purpose programming languages. Scala source code is
intended to be compiled to Java bytecode, so that the resulting executable code
runs on a Java virtual machine. Java libraries may be used directly in Scala
code and vice versa. Scala is object-oriented, and uses a curly-brace syntax.
Scala has many features of functional programming languages, including currying,
type inference, immutability, lazy evaluation, and pattern matching. It also has
an advanced type system supporting algebraic data types, covariance and
contravariance, higher-order types, and anonymous types. Other features of Scala
include operator overloading, optional parameters, named parameters, raw
strings, and no checked exceptions.
 
                                                             $ sdk install scala
--------------------------------------------------------------------------------
Spark (2.2.0)                                          https://spark.apache.org/
 
Apache Spark is an open-source cluster-computing framework. Spark provides an
interface for programming entire clusters with implicit data parallelism and
fault-tolerance.
 
                                                             $ sdk install spark
--------------------------------------------------------------------------------
Spring Boot (1.5.9.RELEASE)               http://projects.spring.io/spring-boot/
 
Spring Boot takes an opinionated view of building production-ready Spring
applications. It favors convention over configuration and is designed to get you
up and running as quickly as possible.
 
                                                        $ sdk install springboot
--------------------------------------------------------------------------------
Sshoogr (0.9.25)                             https://github.com/aestasit/sshoogr
 
Sshoogr is a Groovy based DSL and command line tool for working with remote
servers through SSH.
 
                                                           $ sdk install sshoogr
--------------------------------------------------------------------------------
Vert.x (3.5.0)                                                  http://vertx.io/
 
Vert.x is a tool-kit for building reactive applications on the JVM.
 
                                                             $ sdk install vertx
--------------------------------------------------------------------------------
VisualVM (1.3.9)                                     https://visualvm.github.io/
 
VisualVM is a tool that provides a visual interface for viewing detailed
information about Java applications while they are running on a Java Virtual
Machine.
 
                                                          $ sdk install visualvm
--------------------------------------------------------------------------------

 
To review the usage of SDKMAN! click here.

 
Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Linux Mint Installation

Linux Mint is the operating system for choice for software development platform.

Primary IDE include Eclipse for JavaFX, PhP and c++.  Anaconda along with Spyder is available for Python development.

Wt (pronounced witty) is available for web application development.

A Grails stack is also available for additional Java application development.

LAMP is also operational.

This level of firepower and the latest version of Mint is installed in less than 16 gigabytes of disk space.

This is simply outstanding.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Grails, MySQL and Spring Security

The Grails environment for this example is Grails 3.2.2, Groovy 2.4.7 and JVM 1.8.0_92.

This tutorial will demonstrate how to create a new Grails project, enable MySQL database and Spring Security.  To begin the process create a new Grails project entitled “books” minus quotes.

To review how to accomplish this see the tutorial here.  Next connect the Grails application with MySQL RDBMS by reviewing the tutorial here.

Continue to add Spring security by completing the steps listed below.

BCS Grails Using MySQL RDBMS

The Grails environment for this example is Grails 3.2.2, Groovy 2.4.7 and JVM 1.8.0_92.

To allow Grails to converse with MySQL these following steps should be followed.

First change the build.gradle file to include the MySQL driver as depicted below.

buildscript {
    repositories {
        mavenLocal()
        maven { url "https://repo.grails.org/grails/core" }
    }
    dependencies {
        classpath "org.grails:grails-gradle-plugin:$grailsVersion"
        classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.11.1"
        classpath "org.grails.plugins:hibernate5:6.0.2"
    }
}
 
version "0.1"
group "books"
 
apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"org.grails.grails-gsp"
apply plugin:"asset-pipeline"
 
repositories {
    mavenLocal()
    maven { url "https://repo.grails.org/grails/core" }
}
 
dependencyManagement {
    imports {
        mavenBom "org.grails:grails-bom:$grailsVersion"
    }
    applyMavenExclusions false
}
 
dependencies {
    compile "org.springframework.boot:spring-boot-starter-logging"
    compile "org.springframework.boot:spring-boot-autoconfigure"
    compile "org.grails:grails-core"
    compile "org.springframework.boot:spring-boot-starter-actuator"
    compile "org.springframework.boot:spring-boot-starter-tomcat"
    compile "org.grails:grails-dependencies"
    compile "org.grails:grails-web-boot"
    compile "org.grails.plugins:cache"
    compile "org.grails.plugins:scaffolding"
    compile "org.grails.plugins:hibernate5"
    compile "org.hibernate:hibernate-core:5.1.1.Final"
    compile "org.hibernate:hibernate-ehcache:5.1.1.Final"
    console "org.grails:grails-console"
    compile "org.grails.plugins:spring-security-core:3.1.1"
    profile "org.grails.profiles:web"
    runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.11.1"
    runtime "com.h2database:h2"
    runtime "mysql:mysql-connector-java:5.1.40"
    testCompile "org.grails:grails-plugin-testing"
    testCompile "org.grails.plugins:geb"
    testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
    testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
}
 
 
assets {
    minifyJs = true
    minifyCss = true
}

Next change the application.yml file to describe the connection for the database.

---
grails:
    profile: web
    codegen:
        defaultPackage: books
    spring:
        transactionManagement:
            proxies: false
info:
    app:
        name: '@info.app.name@'
        version: '@info.app.version@'
        grailsVersion: '@info.app.grailsVersion@'
spring:
    groovy:
        template:
            check-template-location: false
# Spring Actuator Endpoints are Disabled by Default
endpoints:
    enabled: false
    jmx:
        enabled: true
 
---
grails:
    mime:
        disable:
            accept:
                header:
                    userAgents:
                        - Gecko
                        - WebKit
                        - Presto
                        - Trident
        types:
            all: '*/*'
            atom: application/atom+xml
            css: text/css
            csv: text/csv
            form: application/x-www-form-urlencoded
            html:
              - text/html
              - application/xhtml+xml
            js: text/javascript
            json:
              - application/json
              - text/json
            multipartForm: multipart/form-data
            pdf: application/pdf
            rss: application/rss+xml
            text: text/plain
            hal:
              - application/hal+json
              - application/hal+xml
            xml:
              - text/xml
              - application/xml
    urlmapping:
        cache:
            maxsize: 1000
    controllers:
        defaultScope: singleton
    converters:
        encoding: UTF-8
    views:
        default:
            codec: html
        gsp:
            encoding: UTF-8
            htmlcodec: xml
            codecs:
                expression: html
                scriptlets: html
                taglib: none
                staticparts: none
endpoints:
    jmx:
        unique-names: true
 
---
hibernate:
    cache:
        queries: false
        use_second_level_cache: true
        use_query_cache: false
        region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
 
dataSource:
       pooled: true
       driverClassName: "com.mysql.jdbc.Driver"
       dialect: "org.hibernate.dialect.MySQL5InnoDBDialect"
environments:
    development:
        dataSource:
            dbCreate: "update" 
            url: "jdbc:mysql://localhost/database?useUnicode=yes&characterEncoding=UTF-8"
            username: "user"
            password:  "password"
    test:
        dataSource:
            dbCreate: update
            url: "jdbc:mysql://localhost/database?useUnicode=yes&characterEncoding=UTF-8"
            username: "user"
            password:  "password"
    production:
        dataSource:
            dbCreate: none
            url: "jdbc:mysql://localhost/database?useUnicode=yes&characterEncoding=UTF-8"
            username: "user"
            password:  "password"
            properties:
               jmxEnabled: true
               initialSize: 5
               maxActive: 50
               minIdle: 5
               maxIdle: 25
               maxWait: 10000
               maxAge: 10 * 60000
               timeBetweenEvictionRunsMillis: 5000
               minEvictableIdleTimeMillis: 60000
               validationQuery: "SELECT 1"
               validationQueryTimeout: 3
               validationInterval: 15000
               testOnBorrow: true
               testWhileIdle: true
               testOnReturn: false
               jdbcInterceptors: "ConnectionState;StatementCache(max=200)"
               defaultTransactionIsolation: java.sql.Connection.TRANSACTION_READ_COMMITTED

Now you should issue the Grails run-app command at the command line as depicted below.

If there are no errors Grails should be conversant with MySQL at this point.  The resulting successful output is depicted below.

The coast is clear for further utilization of MySQL in your grails app.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS New Grails Application

The Grails environment for this example is Grails 3.2.2, Groovy 2.4.7 and JVM 1.8.0_92.

To create a new grails app issue the following command at the command prompt.

grails create-app db01

 

After the command completes the following output can be observed.

To review what grails created change to the newly created application folder and issue the dir command.  The following will be available.

To import the Grails application into Eclipse select the File -> Import option and the following dialog will appear.

Be sure to traverse to the Projects from Folder or Archive option and press the Next option.

To begin the import click the Finish button.

As you can see the newly created db01 file structure in now available in Eclipse.

To run the application issue the following command at the command prompt at depicted below.

grails run-app

The result of the command can be reviewed in the command prompt below.

To review the application in action issue the following command in any available browser.

http://localhost:8080

The result of the command is the running Grails application as listed below.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

 

BCS Java

amb01Java programming language was employed to develop many computer applications.  Applications developed are stand alone as well as web based.

Grails is employed using Groovy programming language as well as other technologies to deliver rich internet applications via the Java Virtual Machine (JVM).

To read more about Java as a programming language click here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Ubuntu Internet Server

There are those times when you are required to produce an active internet server to support delivery of web content and relational database management systems services.  My first choice is the Ubuntu headless server.  This server allows enough flexibility to support Apache, Java, Grails, Ruby on Rails, PHP, Yii, Action Message Format (AMF) Flash Builder and Flex,  (32 and 64 bit) thin client windows application and dot net web application servers. The RDBMS of choice is MySQL.  The significance of using this approach is that it supports thin client windows application to become conversant with MySQL.  This thin client does not require any additional middle ware layer such as ODBC or any other layer.

Another advantage of using Ubuntu is it supports practically all known web technologies and practically all domain specific languages (DSL).

On occasions I develop end user applications on the windows platform and the port them to the server via a web archive (WAR) file where Tomcat 8 application server hosts the allows access to the end user application.

tomcat 8

On other occasions I develop shell scripts to invoke the desired commands which builds the application.  This is typically used for Grails and Ruby On Rails applications.  Also shell scripts are useful whenever a series of shell command need to be executed for various purposes.

Normally when I develop software the Eclipse IDE is the IDE of choice.  There are those occasions when I use Delphi to develop 32 and 64 bit windows and OS X applications.  Plus Delphi has the environment to develop all the mobile and tablet applications in a single platform development environment.

Webmin is a windows based GUI that provides a vehicle to perform almost all the system administration tasks required to keep your server current.

web admin base
Below is a screen shot of the File Manager of Webmin.

webmin file manager

Below is an example of the editor for Webmin.

webmin edit

Putty a secured shell server that is also used to handle other server administration tasks.  The primary difference between Putty and Webmin is the lack of a GUI for issuing commands.  Putty is strictly a command line shell.

putty

The secure connection employed by Putty offers a peace of mind and a sense of security for an environment as powerful as the command environment.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Generate Grails App Shell Script

The command line is a horrible place to assigned to in order to accomplish an assigned task.

The shell script below builds a fully functional web site with a MYSQL backed.  The script has been commented so you can easily follow the scrips flow.

#!/bin/sh
#
#  Perform Houskeeping Tasks
#
defpath=/root
hpath=/home/bcs/grails
famid=tc02
#
#  Establish Home Path
#
cd $hpath/
#
#  Greate Grails App Base
#
grails create-app $famid
#
#  witch over the newly created stack
#
cd $hpath/$famid/
#
#  Copy BuildConfig and DatSource file to new stack
#
cp -f $defpath/DataSource.groovy  -t $hpath/$famid/grails-app/conf 
cp -f $defpath/BuildConfig.groovy -t $hpath/$famid/grails-app/conf 
#
#  Create Domains
#
grails create-domain-class amec.Bishops
grails create-domain-class amec.PresidingElders
grails create-domain-class amec.Churches
grails create-domain-class amec.Clergy
grails create-domain-class amec.Members
grails create-domain-class amec.Officers
#
# Copy finilized domains to new trails stack
#
cp -f $defpath/amec/Bishops.groovy -t $hpath/$famid/grails-app/domain/amec 
cp -f $defpath/amec/PresidingElders.groovy -t $hpath/$famid/grails-app/domain/amec 
cp -f $defpath/amec/Churches.groovy -t $hpath/$famid/grails-app/domain/amec 
cp -f $defpath/amec/Clergy.groovy -t $hpath/$famid/grails-app/domain/amec 
cp -f $defpath/amec/Members.groovy -t $hpath/$famid/grails-app/domain/amec 
cp -f $defpath/amec/Officers.groovy -t $hpath/$famid/grails-app/domain/amec 
#
# Generate Scaffolds for data manipulation
#
grails generate-all amec.Bishops
grails generate-all amec.PresidingElders
grails generate-all amec.Churches
grails generate-all amec.Clergy
grails generate-all amec.Officers
grails generate-all amec.Members
#
# Build War (Web Archive) file
#
grails war
pwd

When this script completes the WAR (web archive) file is ready to be deployed to the application server. Deploy the application and welcome your users.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Eclipse Mars IDE

Well folks Eclipse has done it again. The newest release Mars is available. I have used Mars for the first three milestones and I could not be more pleased. I initially downloaded the Eclipse Mars M3 Packages beginning with the IDE for Java EE Developers. The initial install can be located at the link below.
https://eclipse.org/downloads/packages/release/Mars/M3.

Of course I install the 64 bit version of Eclipse. To make the spelling checker function properly make sure the JDT plugin is installed. The Eclipse Java Development Tools houses the engine for the spell checker.

Install Grails and the associated servers via the Eclipse Marketplace. Be sure to use the latest version. This option give you a nice Java development stack.

Be sure to install the PHP Development Tool (PDT). This feature allows me to program all things PHP like WordPress, Yii, CodeIgniter and other PHP applications.

The tool plugin continue with installing c++, Ruby, Tcl/Tk and Python to round out the development stack.

Since this is the 64bit stack the FlashBuilder plugin will not function properly in a 64 bit stack. A separate 32 bit stack of Eclipse is used to support FlashBuilder.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Grails With A MySQL Backend

There are those times when it is advantageous to connect Grails applications to MySQL relational database management system (DBMS).

The default DataSource.Groovy is depicted below.

dataSource {
    pooled = true
    jmxExport = true
    driverClassName = "org.h2.Driver"
    username = "sa"
    password = ""
}
hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = false
    cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
//    cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
}
 
// environment specific settings
environments {
    development {
        dataSource {
            dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
            url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
        }
    }
    test {
        dataSource {
            dbCreate = "update"
            url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
        }
    }
    production {
        dataSource {
            dbCreate = "update"
            url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
            properties {
               // Documentation for Tomcat JDBC Pool
               // http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Common_Attributes
               // https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/tomcat/jdbc/pool/PoolConfiguration.html
               jmxEnabled = true
               initialSize = 5
               maxActive = 50
               minIdle = 5
               maxIdle = 25
               maxWait = 10000
               maxAge = 10 * 60000
               timeBetweenEvictionRunsMillis = 5000
               minEvictableIdleTimeMillis = 60000
               validationQuery = "SELECT 1"
               validationQueryTimeout = 3
               validationInterval = 15000
               testOnBorrow = true
               testWhileIdle = true
               testOnReturn = false
               ignoreExceptionOnPreLoad = true
               // http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#JDBC_interceptors
               jdbcInterceptors = "ConnectionState;StatementCache(max=200)"
               defaultTransactionIsolation = java.sql.5.0%2Fdocs%2Fapi%2F">Connection.TRANSACTION_READ_COMMITTED // safe default
               // controls for leaked connections 
               abandonWhenPercentageFull = 100 // settings are active only when pool is full
               removeAbandonedTimeout = 120000
               removeAbandoned = true
               // use JMX console to change this setting at runtime
               logAbandoned = false // causes stacktrace recording overhead, use only for debugging
               /*
               // JDBC driver properties
               // Mysql as example
               dbProperties {
                   // Mysql specific driver properties
                   // http://dev.mysql.com/doc/connector-j/en/connector-j-reference-configuration-properties.html
                   // let Tomcat JDBC Pool handle reconnecting
                   autoReconnect=false
                   // truncation behaviour 
                   jdbcCompliantTruncation=false
                   // mysql 0-date conversion
                   zeroDateTimeBehavior='convertToNull'
                   // Tomcat JDBC Pool's StatementCache is used instead, so disable mysql driver's cache
                   cachePrepStmts=false
                   cacheCallableStmts=false
                   // Tomcat JDBC Pool's StatementFinalizer keeps track
                   dontTrackOpenResources=true
                   // performance optimization: reduce number of SQLExceptions thrown in mysql driver code
                   holdResultsOpenOverStatementClose=true
                   // enable MySQL query cache - using server prep stmts will disable query caching
                   useServerPrepStmts=false
                   // metadata caching
                   cacheServerConfiguration=true
                   cacheResultSetMetadata=true
                   metadataCacheSize=100
                   // timeouts for TCP/IP
                   connectTimeout=15000
                   socketTimeout=120000
                   // timer tuning (disable)
                   maintainTimeStats=false
                   enableQueryTimeouts=false
                   // misc tuning
                   noDatetimeStringSync=true
               }
               */
            }
        }
    }
}

A working model of the DataSource.Groovy is depicted as follows:

dataSource {
	pooled = true
	driverClassName = "com.mysql.jdbc.Driver"
	dialect = "org.hibernate.dialect.MySQL5InnoDBDialect"
}
hibernate {
	cache.use_second_level_cache = true
	cache.use_query_cache = false
	cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
	development {
		dataSource {
			dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
			url = "jdbc:mysql://localhost:3306/ame01?useUnicode=yes&characterEncoding=UTF-8"
			username = "bcs"
			password = "XXXXXX"
		}
	}
	test {
		dataSource {
			dbCreate = "update"
			url = "jdbc:mysql://localhost:3306/ame01?useUnicode=yes&characterEncoding=UTF-8"
			username = "bcs"
			password = "XXXXXX"
		}
	}
	production {
		dataSource {
			dbCreate = "update"
			url = "jdbc:mysql://localhost:3306/ame01?useUnicode=yes&characterEncoding=UTF-8"
			username = "bcs"
			password = "XXXXXX"
			pooled = true			
			properties {
				maxActive = -1
				minEvictableIdleTimeMillis=1800000
				timeBetweenEvictionRunsMillis=1800000
				numTestsPerEvictionRun=3
				testOnBorrow=true
				testWhileIdle=true
				testOnReturn=true
				validationQuery="SELECT 1"
			}
		}
	}
}

The next consideration is the BuildConfig.Groovy where we need to tell Grails to use the MySQL RDBMS for the build.

grails.servlet.version = "3.0" // Change depending on target container compliance (2.5 or 3.0)
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.work.dir = "target/work"
grails.project.target.level = 1.6
grails.project.source.level = 1.6
//grails.project.war.file = "target/${appName}-${appVersion}.war"
 
grails.project.fork = [
    // configure settings for compilation JVM, note that if you alter the Groovy version forked compilation is required
    //  compile: [maxMemory: 256, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
 
    // configure settings for the test-app JVM, uses the daemon by default
    test: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
    // configure settings for the run-app JVM
    run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
    // configure settings for the run-war JVM
    war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
    // configure settings for the Console UI JVM
    console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]
 
grails.project.dependency.resolver = "maven" // or ivy
grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits("global") {
        // specify dependency exclusions here; for example, uncomment this to disable ehcache:
        // excludes 'ehcache'
    }
    log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
    checksums true // Whether to verify checksums on resolve
    legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
 
    repositories {
        inherits true // Whether to inherit repository definitions from plugins
 
        grailsPlugins()
        grailsHome()
        mavenLocal()
        grailsCentral()
        mavenCentral()
        // uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
        //mavenRepo "http://repository.codehaus.org"
        //mavenRepo "http://download.java.net/maven/2/"
        //mavenRepo "http://repository.jboss.com/maven2/"
		mavenRepo 'http://repo.spring.io/milestone'
        mavenRepo "http://download.java.net/maven/2/"
    }
 
    dependencies {
        // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
        // runtime 'mysql:mysql-connector-java:5.1.27'
        // runtime 'org.postgresql:postgresql:9.3-1100-jdbc41'
        runtime 'mysql:mysql-connector-java:5.1.29'
    }
 
    plugins {
        // plugins for the build system only
        build ":tomcat:7.0.50.1"
 
        // plugins for the compile step
        compile ":scaffolding:2.0.2"
        compile ':cache:1.1.1'
		compile ':spring-security-core:2.0-RC2'
		compile ":spring-security-ui:1.0-RC1"
		compile ":spring-security-acl:2.0-RC1"
 
        // plugins needed at runtime but not for compilation
        runtime ":hibernate:3.6.10.8" // or ":hibernate4:4.3.1.1"
        runtime ":database-migration:1.3.8"
        runtime ":jquery:1.11.0"
        runtime ":resources:1.2.1"
        // Uncomment these (or add new ones) to enable additional resources capabilities
        //runtime ":zipped-resources:1.0.1"
        //runtime ":cached-resources:1.1"
        //runtime ":yui-minify-resources:0.1.5"
 
        // An alternative to the default resources plugin is the asset-pipeline plugin
        //compile ":asset-pipeline:1.5.0"
 
        // Uncomment these to enable additional asset-pipeline capabilities
        //compile ":sass-asset-pipeline:1.5.1"
        //compile ":less-asset-pipeline:1.5.0"
        //compile ":coffee-asset-pipeline:1.5.0"
        //compile ":handlebars-asset-pipeline:1.0.0.3"
    }
}

Now run your grails application.  If you notice no errors you application will now use MySQL as a back end RDBMS.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.