Issue in SOAP UI with SQL using Grovvy Script
I am hitting DB2 database using grovvy scripts in SOAPUI, the below code was working fine for me for sometime. However suddenly its not working and I am stuck and unable to find a solution The query:SELECT Column_ID FROM Table_Name where Column_TIMESTAMP>'2016-10-26 05:37:22' Below is the code def sqlQueryPopID = "SELECT Column_ID FROM Table_Name where Column_TIMESTAMP>'2016-10-26 05:37:22'" def popID // The code is not entering in the below loop, however was working fine a day back, not sure what happened sqlITOD.query(sqlQueryPopID) {resultSet -> while (resultSet.next()) { popID = resultSet.getString(1) log.info("Popultauin ID is:"+popID) } }//end of result set log.info("The Sql Query:"+sqlITOD.query(sqlQueryPopID) )//This line is giving below Error ERROR: Wed Oct 26 05:37:58 EDT 2016:INFO:groovy.lang.MissingMethodException: No signature of method: groovy.sql.Sql.query() is applicable for argument types: (java.lang.String) values: [SELECT Column_ID FROM Table_Name where Column_TIMESTAMP>'2016-10-26 05:37:22'] Possible solutions: query(java.lang.String, groovy.lang.Closure), query(groovy.lang.GString, groovy.lang.Closure), query(java.lang.String, java.util.List, groovy.lang.Closure), query(java.lang.String, java.util.Map, groovy.lang.Closure), query(java.util.Map, java.lang.String, groovy.lang.Closure), every() Please help me what went wrong as the current code was working fine, somehow it stopped working796Views0likes1CommentGroovy script for database manipulation using project property
I want to execute simple delete query with the schema nametaken from project properties, but I am not sure how to pass the value to it, current way doesn't work for me. import groovy.sql.Sql import com.eviware.soapui.support.GroovyUtils.* def dbURL = context.expand('${#Project#MSSQLUrl}') def dbUser = context.expand('${#Project#MSSQLUser}') def dbPass = context.expand('${#Project#MSSQLPassword}') def dbDriver = context.expand('${#Project#MSSQLDriver}') def dbschema1 = context.expand('${#Project#Schema1}') def dbschema2 = context.expand('${#Project#Schema2}') com.eviware.soapui.support.GroovyUtils.registerJdbcDriver(dbDriver) log.info (dbschema1) //logsEMP_SCHEMA def sql = Sql.newInstance(dbURL, dbUser, dbPass, dbDriver) sql.execute("DELETE FROM ['$dbschema1'].[dbo].[JOB] WHERE EMPNAME = 'NAME1'"); //doesnt work,com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name ''EMP_SCHEMA'.dbo.JOB'. error at line: 14 sql.execute("DELETE FROM [EMP_SCHEMA].[dbo].[JOB] WHERE EMPNAME = 'NAME1'"); //works Dont know how to pass the schema value to SQL querySolved3.8KViews0likes9Comments