Hi,
I have a working Lotus Notes agent. Running on LN 7. My agent runs every 5 minutes, and it sends some mails whenever it finds some specific records on an Microsoft SQL (2005) table.
It usually works ok, but recently it stopped working -more than once now- and won't restart again until the Notes Server is restarted or the Notes admin restarts all the agents (I'm no notes admin, so I'm not really sure what he does, I'm trying to get this info to add to this question).
I'm trying to rule out anything I can think of and the only thing that comes to my mind is that the MS SQL Server on which my LN Agent runs the queries had some stability issues and might not always be online... I thought that that might be the cause of the problem... (I'm trying to cross reference the uptime log from the SQL with the last time my agent has completed successfully).
I was thinking if there's any way to manage the connection, other than what I'm doing, so I can rule out a (lack of) connection problem.
Thanks in advance for any advice you can provide.
Kind regards,
Diego
Option Public
Uselsx "*LSXODBC"
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim subject As String, cc As String, bcc As String, sender As String, OID As String, mailto As String, bodyNotMIME As String
Dim body As NotesMIMEEntity
On Error Goto errorCounter
Set db = session.CurrentDatabase
Gosub SendMailGeneral
Exit Sub
SendMailGeneral:
Dim con As New ODBCConnection
Dim qry As New ODBCQuery
Dim result As New ODBCResultSet
Dim defaultQuery As String
Set qry.Connection = con
If con.ConnectTo("DSN_Name","USER_NAME", "PASSWORD") Then
Set result.Query = qry
defaultQuery = "select TOP (10) * from Message where StatusType=0"
qry.SQL = defaultQuery
result.Execute
If (result.IsResultSetAvailable) Then
Do
result.NextRowcode
//here´s all the code that gets the results from each table´s fields and transform them into notes mails
Loop Until result.IsEndOfData
End If
End If
result.Close(DB_CLOSE)
Return
End Sub