cancel
Showing results for 
Search instead for 
Did you mean: 

No such property: Sql for class: Script19

Highlighted
Regular Visitor

No such property: Sql for class: Script19

Pre-requisite:

I have placed mysql connector jar in soapui lib folder

MySQL database has Persons table with few records

 

I have created Groovy script under a test case, below is the script. When I execute I get following error:

No such property: Sql for class: Script19

Please suggest.

 

 

Groovy script:

 

import groovy.sql.Sql.*


try{
//Create DB Connection

def dbURL = "jdbc:mysql://localhost:3306/testDB"
def dbUser = "root"
def dbPassword = "root"
def driver = "com.mysql.jdbc.Driver"
def dbSQL = Sql.newInstance(dbURL,dbUser,dbPassword,driver)

//Execute Query
def query = "Select * from Persons"
dbSQL.eachRow(query){
//log.info "${it.City}"+"-"+"${it.FirstName}"
log.info "${it.City}"
}

}catch(Exception e){
log.info e.getMessage()
}finally{
//Close Connection
//db.close()
}

1 REPLY 1
Community Hero

Re: No such property: Sql for class: Script19

Chage
From : import groovy.sql.Sql.*
To: import groovy.sql.Sql

And have a look at the below thread:
https://community.smartbear.com/t5/SoapUI-Open-Source/can-t-register-JDCB-driver-class/td-p/130525


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors