groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Imholz, John J." <imho...@musc.edu>
Subject Database Drivers
Date Wed, 05 Apr 2017 18:28:44 GMT
In Groovy Console "Class" seems to find the Driver, but "Sql" does not?  What am I misunderstanding?
 (BTW, the connection string is what I'm using in the sqlline utility)

--- console ---
import java.sql.*
import groovy.sql.Sql

def d =  Class.forName('net.sourceforge.jtds.jdbc.Driver').newInstance()
println d.toString()

def sql = Sql.newInstance('jdbc:jtds:sybase://server.musc.edu:4100/mydb;tds=5.0',
                          'user',
                          'password',
                          'net.sourceforge.jtds.jdbc.Driver'
                          )

--- output ---
jTDS 1.2.5
Exception thrown

java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver
                at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
                at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
                at java.lang.Class.forName0(Native Method)
                at java.lang.Class.forName(Class.java:264)
                at groovy.sql.Sql.loadDriver(Sql.java:705)
                at groovy.sql.Sql.newInstance(Sql.java:445)
                at groovy.sql.Sql$newInstance.call(Unknown Source)
                at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
                at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
                at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:149)
                at ConsoleScript61.run(ConsoleScript61:7)




-------------------------------------------------------------------------
This message was secured via TLS by MUSC.

Mime
View raw message