Forum Discussion

Kevin_Mannering's avatar
Kevin_Mannering
Occasional Contributor
14 years ago

SQL connection driver not found

Am running a groovy script as a test step from the green start button. The jdbc driver is not found. I have put it in lib and bin/ext

Dunno if soapui.bat runs or if SOAPUI_HOME is set or if this is set:
set JAVA_OPTS=%JAVA_OPTS% -Djava.library.path="%SOAPUI_HOME%\"

and I would certainly rtfm if I could find the fm.

So, is there an answer to this and is there any docu on soaupui-pro.bat, system properties, and jvbc connections generally?

have spent some time on this and fiddled around with every howto answer I could find on the forum.

We are running SOAPUI-PRO 4.0.1 (and have to stay there)

As far as I can see JAVA_HOME, JAVA_PATH, and CLASSPATH are not set as system variables or properties.

soapui.home etcetera is as follows:

soapui.ext.actions=C:\Program Files\SmartBear\soapUI-Pro-4.0.1/bin/actions
soapui.ext.libraries=C:\Program Files\SmartBear\soapUI-Pro-4.0.1/bin/ext
soapui.ext.listeners=C:\Program Files\SmartBear\soapUI-Pro-4.0.1/bin/listeners
soapui.home=C:\Program Files\SmartBear\soapUI-Pro-4.0.1/bin
soapui.properties=soapui.properties


Here is the code:

1 com.eviware.soapui.support.GroovyUtils.registerJdbcDriver( "net.sourceforge.jtds.jdbc.Driver" )
2 import groovy.sql.Sql

4 log.info "kevtest1"

6 def sql = Sql.newInstance("jdbc:jtds:sybase:://ourdatabase.de:portnr/test",
7 "user","userpassword","net.sourceforge.jtds.jdbc.Driver")

9 log.info "kevtest2"

11 sql.firstRow("select LKZ from vertrag..MEHRWERTSTEUER")
12 log.info ("test" + row.LKZ)

the script throws an error on line6

Tue Jul 17 16:19:51 CEST 2012:ERROR:An error occured [net.sourceforge.jtds.jdbc.Driver], see error log for details

The outputlog is this
Tue Jul 17 16:19:51 CEST 2012:INFO:kevtest1

The error log is here:

Tue Jul 17 16:19:51 CEST 2012:ERROR:java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver
java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at groovy.sql.Sql.loadDriver(Sql.java:483)
at groovy.sql.Sql.newInstance(Sql.java:305)
at groovy.sql.Sql$newInstance.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
at Script5.run(Script5.groovy:6)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:96)
at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:88)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:148)
at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:274)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

2 Replies

  • Kevin_Mannering's avatar
    Kevin_Mannering
    Occasional Contributor
    Well I had a lot of fun solving this, and would like to share it.

    First I upgraded to the latest version of soapui-Pro. The installation causes the first problem: I am running a German version of windows, so although Windows will have no problem finding "c:\Programme" rather than "C: \program files" Soapui will have them and won't find the drivers as a result, do so don't take the default at installation set up, tell it to use "C:\Programme" or whatever if you are using a non_English version of windows.


    Second, don't use the desktop icon to start Soapui. This is the property of what the install created and it doesn't load the drivers.

    C:\Programme\SmartBear\soapUI-Pro-4.5.1\bin\soapUI-Pro-4.5.1.exe

    Start Soapui-pro from C:\Programme\SmartBear\soapUI-Pro-4.5.1\bin\. this will open a cmd black window and provide you with a log. (Soapui also tries to save this log, but that failed on me because of permissions.)

    Here comes the exciting bit: it will log this info, telling you which drivers he has picked up!!

    If your driver is not there, it won't find it later

    12:54:51,056 INFO [SoapUI] Adding [C:\Program Files\SmartBear\soapUI-Pro-4.5.1\
    bin\ext\jconn3.jar] to extensions classpath
    12:54:51,057 INFO [SoapUI] Adding [C:\Program Files\SmartBear\soapUI-Pro-4.5.1\
    bin\ext\postgresql-8.3-604.jdbc3.jar] to extensions classpath
    12:54:51,057 INFO [SoapUI] Adding [C:\Program Files\SmartBear\soapUI-Pro-4.5.1\
    bin\ext\postgresql-8.3-604.jdbc4.jar] to extensions classpath
    12:54:51,058 INFO [SoapUI] Adding [C:\Program Files\SmartBear\soapUI-Pro-4.5.1\
    bin\ext\sqljdbc.jar] to extensions classpath

    Those readers still awake will have noticed that on my pc those directory paths are wrong, but that doesn't bother our hero, he found the drivers there and if he is happy, so am I.

    the key driver for me is the jconn3.jar for sybase.

    Now for the connection strings. First you have to set your preferences: select preferences from the File dropdown on the soapui front page.

    goto you JDBC driver properties and put this in:
    Driver Connection String template
    com.sybase.jdbc3.jdbc.SybDriver jdbcsybase:Tds<HOST:127.0.0.1>:<PORT:5000>/<DB>?user=<USER>&password=<PASSWORD>

    You are ready to test the connection. In your JDBC Request chose the Driver you just put in your preferences and fill in the rest of the form. Click on test connection and surprise everyone in the office by performing somersaults if it works.

    in you groovy script try this:

    def sql = Sql.newInstance('jdbc:sybase:Tds:host:port/db', "user","password", 'com.sybase.jdbc3.jdbc.SybDriver')

    "" probably work as well as ' '.

    Put on your best clown's hat and redo your somersault routine.

    This has taken me two days to get working.
  • Kevin_Mannering's avatar
    Kevin_Mannering
    Occasional Contributor
    Couple of points:

    I forgot to mention I used the soapui-pro.bat in C:\Programme\SmartBear\soapUI-Pro-4.5.1\bin to get to the cmd black window and see the log.

    Subsequently I have tested the desktop icon, which calls ...\bin\ soapUI-Pro-4.5.1.exe. The connections work regardless of how I start Soapui-pro, but if I use the exe file I can't see the log.

    One very strange thing: after I start soapui-pro, if I run my groovy script first, I get the driver not found error again. However, if I run the JDBC request to the same database it works, and then the groovy script works too!

    I guess the JDBC request activates the preferences somehow, but that is just a guess.