I saw the following error when I run the following code. Can you help? My SOAPUI version is 5.5.0
Mon Oct 21 22:55:32 EDT 2019:INFO:No signature of method: groovy.sql.Sql.eachRow() is applicable for argument types: (java.lang.String) values: [select * from product]
Possible solutions: eachRow(java.lang.String, groovy.lang.Closure), eachRow(groovy.lang.GString, groovy.lang.Closure), eachRow(java.lang.String, groovy.lang.Closure, groovy.lang.Closure), eachRow(java.lang.String, java.util.List, groovy.lang.Closure), eachRow(java.lang.String, java.util.Map, groovy.lang.Closure), eachRow(java.util.Map, java.lang.String, groovy.lang.Closure)
import groovy.sql.Sql
// obtain the connection to database
// do the transaction
// close database connection
try{
// connecting to db
def dbURL="jdbc:mysql://localhost:3306/retail"
def dbUsername="root"
def dbPassword="root"
def dbDriver="com.mysql.jdbc.Driver"
def db = Sql.newInstance(dbURL,dbUsername,dbPassword,dbDriver)
// interact with DB
/**********************Select query*******************************/
def q1 = "select * from product" // simple select query - more than 1 row
def q2 = "select * from product where prod_id='4'" // 1 row
def q3 = "select * from product where prod_name like '%QTP%'" // more than 1
// eachRow, rows
db.eachRow(q3)
// firing a query
} catch(Exception e){
log.info "Some db error"
log.info e.getMessage()
} finally{
db.close()
}