tags:

views:

354

answers:

1

I am trying to connect a simple groovy script to the DB.

Code:

import groovy.sql.Sql
class GroovySqlExample2{
  static void main(String[] args) {
    def sql = Sql.newInstance("jdbc:sqlserver://MYSERVERIP", "uname",
           "pwd", "net.sourceforge.jtds.jdbc.Driver")
    sql.eachRow("select * from word"){ 
      println it.spelling + " ${it.part_of_speech}"
    }
  }
}

I've placed jtds-1.2.3.jar inside C:\groovy-1.6.3\lib folder but the above code keeps complaining:

java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver
A: 

Make sure you have a GROOVY_HOME Environment variable set to c:\groovy-1.6.3

Jared