can not update oracle table in soapui groovy
Hi,
I am doing data driven testing. My requirement is to take data from request properties and response properties then insert or update oralce table.
Now I can take data from properties and can select data from table. The update or delete can never success. I did google and find no solution. Stuck here. Could you please help?
-
-----Groovy Code------
import groovy.sql.Sql
import oracle.jdbc.driver.OracleTypes
//Establish JDBC Connection to the DB
def con = Sql.newInstance("jdbc:oracle:thin:@127.0.0.1:1521:XE", "TESTDB", "TESTDB", "oracle.jdbc.driver.OracleDriver");
def comcode = con.rows("select * from DDT where TEST_STEP_ID='3.3.3'")
log.info(comcode[0])
sql.executeUpdate("UPDATE DDT SET I_COMMODITY_CODE='99999' where TEST_STEP_ID='3.3.3'")
con.close()
-----End of Groovy Code------
Error message:
Groovy.lang.MissingPropertyException: No such property:sql for class:Sript1 error at line xx.
In what line does this error happen? Did you test your connection string (it can be done using soapui interface)?
Also this part looks confusing to me, you connection is called con not sql
> sql.executeUpdate("UPDATE DDT SET I_COMMODITY_CODE='99999' where TEST_STEP_ID='3.3.3'")
Shouldn't it be con.executeUpdate("UPDATE DDT SET I_COMMODITY_CODE='99999' where TEST_STEP_ID='3.3.3'")?
And I belive you need import of goovy.sql.*