Forum Discussion

eetawil_yahoo_c's avatar
eetawil_yahoo_c
New Contributor
7 years ago

Error jz00l when Connecting to sybase database via groovy

Hi, when I connect using the JDBC Request Test Step to my Sybase DB it works (or when I use the "test connection" button).

 

When I do the same via groovy it doesn't here is the code and the logs: 

I'm not sure if it's a driver problem (I have jconn4.jar in the bin\ext folder), it's not a credential problem. I'm using ReadyAPi 2.5.0 Pro

 

import groovy.sql.Sql

def ConObj = context.testCase.testSuite.project.databaseConnectionContainer.getResourceByName('TestAutomation');
def sql = Sql.newInstance(ConObj.getConnectionString());

Logs:

ERROR: java.sql.SQLException: JZ00L: Connection failed. Examine the SQLWarnings associated with this exception for the following reason (s):
java.sql.SQLException: JZ00L: Connection failed. Examine the SQLWarnings associated with this exception for the following reason (s)
at com.sybase.jdbc4.jdbc.ErrorMessage.raiseError(ErrorMessage.java:768)
at com.sybase.jdbc4.tds.Tds.processLoginAckToken(Tds.java:5356)
at com.sybase.jdbc4.tds.Tds.doLogin(Tds.java:725)
at com.sybase.jdbc4.tds.Tds.login(Tds.java:579)
at com.sybase.jdbc4.jdbc.SybConnection.tryLogin(SybConnection.java:422)
at com.sybase.jdbc4.jdbc.SybConnection.handleHAFailover(SybConnection.java:3335)
at com.sybase.jdbc4.jdbc.SybConnection.<init>(SybConnection.java:348)
at com.sybase.jdbc4.jdbc.SybConnection.<init>(SybConnection.java:253)
at com.sybase.jdbc4.jdbc.SybDriver.connect(SybDriver.java:232)
at com.eviware.soapui.support.GroovyUtils$DriverProxy.connect(GroovyUtils.java:151)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at groovy.sql.Sql.newInstance(Sql.java:279)
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:125)
at Script7.run(Script7.groovy:10)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:98)
at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:83)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:158)
at com.eviware.soapui.impl.wsdl.panels.teststeps.DebuggableProGroovyScriptStepDesktopPanel$RunDebugAction$1.run(DebuggableProGroovyScriptStepDesktopPanel.java:177)
at java.lang.Thread.run(Thread.java:748)

  • Turns out I was just missing some parameters!

     

    def sql = Sql.newInstance(ConObj.getConnectionString() ,userName, PAssword, driver);

    Didn't think of it as this information was already in the ConnectionString!!

    When I read the connection string variable it showed the username and pass in it as expected...strange!

  • Turns out I was just missing some parameters!

     

    def sql = Sql.newInstance(ConObj.getConnectionString() ,userName, PAssword, driver);

    Didn't think of it as this information was already in the ConnectionString!!

    When I read the connection string variable it showed the username and pass in it as expected...strange!