It's not a secret anymore!
The moose likes Groovy and the fly likes groovy SQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Groovy
Bookmark "groovy SQL" Watch "groovy SQL" New topic

groovy SQL

G Horie

Joined: Feb 03, 2005
Posts: 10

I'm a groovy newbie. I've been trying different example SQL against mysql, but I've been getting this exception:

I'm not sure where I'm going awry. The javadoc say this:

An ExceptionInInitializerError is thrown to indicate that an exception occurred during evaluation of a static initializer or the initializer for a static variable.

To figure out what classes are being created, I did a 'groovyc mysql_test.groovy' and found the following 2 classes compiled:

So I'm assuming its the mysql_test.class is throwing the exception, but I'm not sure why. Here's my code:

Any help is appreciated.


- G.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

I just ran your code and it worked fine. What version of Groovy are you using?

GenRocket - Experts at Building Test Data
Peter Johnson

Joined: May 14, 2008
Posts: 5852

Is the MySQL JDBC driver JAR file in your classpath?

JBoss In Action
G Horie

Joined: Feb 03, 2005
Posts: 10
Sorry its taken me so long to respond. My wife had a baby last week, so I went offline until now. Its a girl.

For the version, I'm using groovy v.1.6.3. For the jar, I copied it to {user.home}/.groovy/lib.

Any thoughts?

I agree. Here's the link:
subject: groovy SQL
It's not a secret anymore!