Forum Discussion

cbyndr's avatar
cbyndr
Contributor
15 years ago

"No suitable driver" SQLexception though drivers in ext

With pro version 3.6.2, build soapui-pro-daily-2010-11-02, attempting to open jdbc connection, just as we had done with version 3.5.1.

So, of course, we placed mysql and oracle drives in the new ext directory.

Here is groovy scrip for the connection, which had worked fine in 3.5.1:

import groovy.sql.Sql
def dbPath = <withheld>
def dbDriverName = "oracle.jdbc.driver.OracleDriver"
def dbUserName = <withheld>
def dbPassword = <withheld>
def sql = Sql.newInstance(dbPath, dbUserName, dbPassword, dbDriverName);

On the def sql statement, we are hit with this:

Thu Nov 04 08:05:41 EDT 2010:ERROR:java.sql.SQLException: No suitable driver
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:545)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at groovy.sql.Sql.newInstance(Sql.java:273)
at groovy.sql.Sql.newInstance(Sql.java:294)
at groovy.sql.Sql$newInstance.call(Unknown Source)
at Script1.run(Script1.groovy:15)
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(ThreadPoolExecutor.java:651)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
at java.lang.Thread.run(Thread.java:655)


Note: when the drivers are removed from ext, we get this:

Thu Nov 04 09:58:24 EDT 2010:ERROR:java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

2 Replies

  • Hello,

    I'm guessing you are calling DB from Groovy script. Some changes regarding class loading was done in 3.6.* so to call DB from Groovy you need to:
    move the jdbc driver to the lib folder
    add next groovy method to the script:
     
    GroovyUtils.registerJdbcDriver(....)

    so that the driver gets reloaded with the correct class loader.

    Hope this helps,
    robert