groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <>
Subject Re: Using Groovy in Business Intelligence applications via dyna4JDBC driver
Date Wed, 16 Nov 2016 19:16:12 GMT
I finally got around to giving this a try. I noticed some minor issues
with the pom which require me to have some @GrabExclude statements
that I would prefer not to need. I created an issue for your

Anyway, it was fun to play with:

import groovy.sql.Sql

def script = '''
def fields = [t: 'Ticker', name: 'Name', l_cur: 'Close']
def base = ''
def url = new URL("$base=NASDAQ:AAPL,IBM,MSFT,GOOG")
def json = url.text.replaceFirst("//", "")
def data = new groovy.json.JsonSlurper().parseText(json)
println fields.values().collect{ "$it::" }.join('\t')
data.each { row -> println fields.keySet().collect{ row[it] }.join('\t') }

def url = 'jdbc:dyna4jdbc:scriptengine:groovy'
Sql.withInstance(url) { sql ->
  sql.eachRow(script){ row -> println "$row.Ticker $row.Close" }

Cheers, Paul.

On Wed, Nov 9, 2016 at 2:45 AM, Péter Gergely Horváth
<> wrote:
> Hi Groovy Users,
> There is one more area where the power of Groovy can now be utilized: I
> developed a JDBC driver called dyna4JDBC (, which
> allows Groovy (or any JSR-223 compatible scripting language) to be called
> via the JDBC API. The standard output echoed by the script is parsed to a
> JDBC Result Set, so that the caller application can process it further.
> The goal of this driver was to allow JDBC-compatible reporting and ETL
> applications calling dynamic JVM language scripts as if they were databases
> and exposing the script output as a result set for further processing (e.g.:
> advanced visualizations: charts etc.)
> For example, you can now use Eclipse BIRT [1] reporting application and
> create reports, which are backed by a Groovy script: You can simply
> configure a JDBC datasource in Eclipse BIRT and write a Groovy script
> against that datasource instead of SQL. The output the script prints to the
> standard output will appear as the result set of the "query".
> You can get a quick introduction on the project home page [2]. The
> documentation is on GitHub Wiki [3], and the binary version of the driver
> can be downloaded from GitHub [4] or from Maven Central [5].
> I am sharing it here in the hope that it might be useful for some people and
> that I could potentially get some feedback you. :)
> Cheers,
> Peter
> [1]
> [2]
> [3]
> [4]
> [5]

View raw message