Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
Author

groovy SQL

G Horie
Greenhorn

Joined: Feb 03, 2005
Posts: 10
Hi,

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:
mysql_test.class
mysql_test$_query_closure1.class

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.

Thanks,

- G.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

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


GenRocket - A Test Data Generation Platform
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5778
    
    7

Is the MySQL JDBC driver JAR file in your classpath?


JBoss In Action
G Horie
Greenhorn

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?

Thanks.
 
wood burning stoves
 
subject: groovy SQL
 
Similar Threads
Recursoin (groovy or java)
Critique Please
I need metaClass advice for Groovy
Anyone using Scala?
How does inner class access outter class functions?