• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

groovy SQL

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just ran your code and it worked fine. What version of Groovy are you using?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Get meta with me! What pursues us is our own obsessions! But not this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic