LS:DO- ODBC could not complete the requested operation

I have a scheduled agent which connects and execute a stored procedure on SQL Server. The agent was running fine on Domino 6.5.4 server.

Recently we moved database to Domino 8.5.1 server. Now agent throws an error message “LS:DO- ODBC could not complete the requested operation” while executing the stored procedure. However the agent runs fine if ran from notes client.

Here is code from the agent which is not working

Call con.ConnectTo(datasource, userid, password)

If con.GetError <> DBstsSUCCESS Then

Call currentLog.LogAction( “ODBC Connection error …” )

Error con.GetError, "Connect error: " & con.GetErrorMessage & " + Long msg: " & con.GetExtendedErrorMessage

End If

Set qry.Connection = con

qry.sql = "Exec ChgST_OUTLOOK_GvnXML " & “'” & xml & “'”

If qry.GetError <> DBstsSUCCESS Then

Call currentLog.LogAction( “Query SQL error …” )

Error qry.GetError, "Query error: " & qry.GetErrorMessage & " + Long msg: " & qry.GetExtendedErrorMessage

End If

Set res.query = qry

res.Execute 'Error is thrown at this line

If res.GetError <> DBstsSUCCESS Then

Call currentLog.LogAction( “Query NOT successfully executed …” )

Error res.GetError, "Result error: " & res.GetErrorMessage & " + Long msg: " & res.GetExtendedErrorMessage

End If

Please advise. TIA