Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

groovy SQL

 
G Horie
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just ran your code and it worked fine. What version of Groovy are you using?
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the MySQL JDBC driver JAR file in your classpath?
 
G Horie
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic