How to UPDATE a SQL server database via a MID Server from a script

bpolo
Tera Guru

We have a script where we insert an ECC queue record to UPDATE a SQL table. When we set the SQL query to be a SELECT statement it works. But when we change the SQL statement to be an UPDATE we get the following error: 

SQLException: Statement.executeQuery() cannot issue statements that do not produce result sets.
 
It seems that the statement that should be executeUpdate(). What field needs to be set up on the ECC queue record to make it say executeUpdate instead executeQuery() ?  Thanks in advance!
1 ACCEPTED SOLUTION

bpolo
Tera Guru

We have found a solution - This is the parameter that we required to get the UPDATE of the SQL table to execute successfully: 

<parameter name= "work" ><update table = "alerts.status" where = "ServerName %= 'NCOMS' AND ServerSerial=3935" ><Agent>ServiceNow - INC10020</Agent><URL>http://Macintosh-9.local:8080/glide/incident.do?sys_id=17a31f380a0a0bae0048ca875c8891d0</URL><Severity quoted = "false" >3</Severity><Acknowledged quoted = "false" >0</Acknowledged></update></parameter>

View solution in original post

6 REPLIES 6

Thanks very much for your response. I tried making the name as you said but it did not work. We are still getting an error: 

Statement.executeQuery() cannot issue statements that do not produce result sets.
name: "executeUpdate"

 Do you think that there is a parameter that needs be set up when we create the xml that has the value "executeUpdate" instead? Thanks!

bpolo
Tera Guru

We have found a solution - This is the parameter that we required to get the UPDATE of the SQL table to execute successfully: 

<parameter name= "work" ><update table = "alerts.status" where = "ServerName %= 'NCOMS' AND ServerSerial=3935" ><Agent>ServiceNow - INC10020</Agent><URL>http://Macintosh-9.local:8080/glide/incident.do?sys_id=17a31f380a0a0bae0048ca875c8891d0</URL><Severity quoted = "false" >3</Severity><Acknowledged quoted = "false" >0</Acknowledged></update></parameter>