With a spatial database available, let's try using grails to connect to it. To do that we'll create a new grails app and add the libraries we need to BuildConfig.groovy. First add the repositories that contain the libraries.

Getting started with OpenShift. I started on Windows 8 Professional 64 bit laptop, while there are instructions available here and there, I eventually installed a Ubuntu VM desktop and found it much easier to work with OpenShift this way.
These steps assume linux OS.

First create an account here.
Next, install the RedHat Client rhc:
https://www.openshift.com/developers/rhc-client-tools-install
Run through setup and ssh configuration prompts.
Once the RedHat Client Tools are available, we are ready to begin our first spatial application!
We will begin by creating a webapp that will run under tomcat7 and connect to postgis enabled database.

1) rhc app create spatialapp Tomcat7 postgresql-8.4

Now let's check out what was created for us.

2) rhc show-domain

I should see a git URL, ssh host, postgres database with the same name as my webapp.

In part one we discussed building out a service class to perform our distance search. Now in part two, we'll build out the rest of the grails framework namely a GSP page to capture user input, a controller to process the form, and a GSP page to render the results as an html table.

Let's start with a controller to test that we can pass user input into our service class SearchByDistance.groovy. First, we'll want to inject the Oracle dataSource into our controller. To do this we need to edit our DataSource.groovy file in the conf folder.

Now we can inject this into the controller by simply defining a dataSource. In the controller we also define a list action. The list action grabs user submitted params which we'll print out for debugging purposes, followed by submitting those parameters to our SearchByDistance service. Lastly we'll return a list of our domain object results by default to the list.gsp page.