Bob_K
16 years agoOccasional Contributor
I need help retrieving data from SQL Server in groovy script
In my test case I'm making a request that creates a number of database records, I'm trying to add a groovy script step that will retrieve one of the db records. I've stripped my script down to a bare minimum to test the connection but I still get an error. I'm using sql server 2005 for the db.
I'm getting this error:
import groovy.sql.Sql
def sql = Sql.newInstance("jdbc:sqlserver://99.999.999.99", "dbuserid", "dbpass", "com.microsoft.sqlserver.jdbc.SQLServerDriver")
sql.eachRow("select first_name from myTable")
I'm getting this error:
groovy.lang.MissingMethodException: No signature of method: groovy.sql.Sql.eachRow() is applicable for argument types: (java.lang.String) values: {"select first_name from myTable"}