Sql

I have an agent that connects to an external database using ODBCConnection.

I created an ODBC Datasource in the Domino Server, however, my agent still can’t connect to that datasource, but if i created a ODBC Datasource on the clien’t PC, the connection is OK.

Is there a way to connect to an external Dbase by just defining the ODBC Datasource on a Domino Server rather than the Client’s PC?

Subject: SQL

How You’ve started the agent - manually?

Then Your Frontend (Client) need’s the ODBC Datasource.

Only Agents startet by the agent-manager will use the Server-ODBC-Connection.

RB

Subject: RE: SQL

rb,

the agent works fine if i add a Datasource on the client’s side and run it manually. however, my agent runs on a scheduled basis, i already added a server datasource but still the agent cannot connect to the external dbase.

below is my code:

Uselsx “*LSXODBC”

Sub Initialize

Dim con As New ODBCConnection

Dim qry As New ODBCQuery

Dim result As New ODBCResultSet

Dim msg As String

Dim doc As notesdocument

Dim vdoc As notesdocument

Dim s As NotesSession

Dim db As NotesDatabase

Dim dcol As notesdocumentcollection

Dim ws As New notesuiworkspace

Dim dateTime As New NotesDateTime(“01/01/2000”)

Dim RTI

Set S = New NotesSession

Set db=s.Currentdatabase

Set qry.Connection = con

Set result.Query = qry

con.ConnectTo(“SQL Notes”),(“username”),(“password”)

qry.SQL = “SELECT * FROM students”

result.Execute

Messagebox result.NumColumns

msg = “Student names:” & Chr(10)

Do

result.NextRow

For i = 1 To result.NumColumns

msg = msg & " " & result.GetValue(i) If i=1 Then

abc = result.GetValue(i)		

Else

def = result.GetValue(i)		

End If			

Next

Set MDoc = New NotesDocument(Db)

MDoc.Form = "test"               

MDoc.studnumber = abc

MDoc.emp_number = def	

Call MDoc.Save (False, False)    	

Loop Until result.IsEndOfData

Messagebox msg,, "Student data"

result.Close(DB_CLOSE)

con.Disconnect

End Sub