Quantcast

Database Drivers

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Database Drivers

Imholz, John J.
This message was sent securely by MUSC

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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database Drivers

Mario Garcia
Hi:

How is the driver added to the classpath ? Through @Grab ? 

Cheers
Mario

2017-04-05 20:28 GMT+02:00 Imholz, John J. <[hidden email]>:
This message was sent securely by MUSC

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.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Database Drivers

Imholz, John J.
This message was sent securely by MUSC

The jar is in /usr/share/java

 

I’m not explicitly loading it. I’m just running “./gradlew console” at the root of the application.

 

jji

 

From: Mario Garcia [mailto:[hidden email]]
Sent: Friday, April 7, 2017 3:25 AM
To: [hidden email]
Subject: Re: Database Drivers

 

Hi:

 

How is the driver added to the classpath ? Through @Grab ? 

 

Cheers

Mario

 

2017-04-05 20:28 GMT+02:00 Imholz, John J. <[hidden email]>:

This message was sent securely by MUSC

 

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.

 




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