Forum Discussion

ilovechiku's avatar
9 years ago

SOAP UI 5.2.1 and database validations failing


 I have soap ui free version 5.2.1 

iam using windows 10. Have the latest JRE 8.0

What am confused is what .jar file should i be using. It is giving me a error on connecting to the database at the line 


testRunner.testCase.setPropertyValue("EmployeeID", getEmployeeIdFromDB(db))


below is my code:


/*import groovy.sql.Sql"")
def db = connectDataBase()
testRunner.testCase.setPropertyValue("EmployeeID", getEmployeeIdFromDB(db)) testRunner.testCase.getPropertyValue("EmployeeID")




Error am seeing is


under soapUI log i see


ERROR:An error occurred [Cannot invoke method firstRow() on null object], see error log for details


Could this be because of the out dated .jar file. Iam currently having sqljdbc4.jar  under the location


C:\Program Files\SmartBear\SoapUI-5.2.1\bin


Please let me know what is going on ?. Is the jar file too old?. is the location wrong?

5 Replies

  • rupert_anderson's avatar
    Valued Contributor



    I can't coment on the the driver file suitability, as I dont have MS SQLServer to test with, but the location of where you have copied the driver jar sounds like it could be wrong - normally it should be copied to:




    This should be the location for all external libraries (jar files) that you want to be added to the SoapUI class path.


    As for the code, I can't see the contents of that connectDataBase() method, but here is an example of a working Groovy SQL script for the H2 DB, should be very similar, just a different driver string:


    import groovy.sql.Sql
    import org.h2.Driver"org.h2.Driver")
    def db = Sql.newInstance("jdbc:h2:mem:test", "org.h2.Driver")
    db.eachRow("select * from quotes"){invoice->

    Hope this helps,




    • ilovechiku's avatar

      no that didnt help much :smileysad:

      def dbDriver = " ,org.h2.Driver"
      def db = Sql.newInstance(dburl, dbUserName, dbPassword, dbDriver)


      could this syntax be wrong ?


  • kondasamy's avatar
    Regular Contributor

    I could able to connect to MS SQL server using the below connection string,


    GroovyUtils.registerJdbcDriver( "" )
    sql = Sql.newInstance("jdbc:sqlserver://$DB_URL;databaseName=$DB_NAME;user=$DB_LOGIN;password=$DB_PWD","")

    Also the DB_URL should be in the format -