I have connected to SQL server ( SQL 2000 ) in Agent by using ADO connection as following script. This agent gets data from SQL server and udpate/insert notes document in Notes database. This agent is scheduled to run on 01:30 AM, and I can see following logs from server log file.
02/11/2008 02:01:02 AM AMgr: Agent (‘GetEmp_FromHRDW’ in ‘Korea\Office\krsorg01.nsf’) error message: ADODB.Recordset: Operation is not allowed when the object is closed.
02/11/2008 02:01:58 AM Agent Manager: Execution time limit exceeded by Agent ‘GetEmp_FromHRDW’ in database ‘Korea\Office\krsorg01.nsf’. Agent signer ‘Nammi Oh/KR-Korea/3M/US’.
From the log, ADO Connection seems to have disconnected before Agent execution time limit exceeded error happens.
I’m not sure if this is due to SQL server connection time limit ( if that kind of function exists in SQL server ) or Notes Agent run time limit.
When I run this scheduled agent manually, it also stops after for a while. So, I don’t think this is due to the difference between manual running and scheduled running.
**** In Agent ********
In (Options)
Option Public
Use “ScrLib”
**** In Script Library *******
Sub Initialize
Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
Set cm = CreateObject("ADODB.Command")
Set rs1 = CreateObject("ADODB.Recordset")
Set cm1 = CreateObject("ADODB.Command")
Set rssub = CreateObject("ADODB.Recordset")
Set cmsub = CreateObject("ADODB.Command")
cn.open "Provider=sqloledb;Data Source=krldw01;Initial Catalog=HR;User Id=hr;Password=******"
Set cm.ActiveConnection = cn
Set cm1.ActiveConnection = cn Set cmsub.ActiveConnection = cn
End Sub
Sub Terminate
cn.close
rs.close
rs1.close
rssub.close
End Sub