Link to home
Start Free TrialLog in
Avatar of coronoahcoro
coronoahcoroFlag for United States of America

asked on

Lotus Notes Agent: ODBC Driver. Data source name not found

We have an agent that runs on our database to get contact records from our AS400 system and update the records in our Lotus Notes database. If I run this agent from Actions menu it works just fine but when I schedule it to run everyday, it gives this error message on the log file:

AMgr: Agent ('AgentName' in 'DatabaseNamet.nsf') message box: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

We have the Data source hard coded in the agent and in my PC, I've setup an ODBC connection from the ODBC Administrator to match the name so I guess that's why I can do it manually. Does that mean I have to have the ODBC connection set up on the server too for the agent to run on schedule?
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

A scheduled agent runs on the server. So indeed, you need to set up an ODBC connection on the server as well.
For scheduled agents, absolutely you do. You should probably put it in under System DSN.
If you decide to have something in a document displaying data dynamically from the AS400 as a user opens the document or an agent that a user can run themselves interactively, then the data source will need to be on the PC.
Avatar of coronoahcoro

ASKER

Hmm so I created the ODBC connection on the server and run the Test Agent:basically I am just hoping that when the agent runs it will write something in the log.nsf, but the agent is stuck on the server now even though I tried to stop the task so many times: Here is my code:

Sub Initialize
	On Error Goto errorHandler
		
	Set con = New ODBCConnection
	
	Print  "Before connection to AS400"
	If con.ConnectTo("AS400") Then
		Print  "Connection successful to AS400"
	End If
	
errorHandler:
	Messagebox con.GetExtendedErrorMessage,, con.GetErrorMessage
	con.Disconnect
	Exit Sub
End Sub

Open in new window


When I go to Server Task I see that the Agent is running but using 0 % utilization and I can't make it go away. Any suggestion why this happens?
Below is the message on the Server Task:

Agent Manager        Executive '2': Running agent 'Test agent' in 'DatabaseName.nsf' [namgr]
Is it because of the MessageBox? Shoot ...
I guess right now if anyone can help me to find out how I can find out whether the connection works or not. That will be great.
SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Additional comment:

While the ODBC (LS:DO) classes in LotusScript are familiar and easy to use, they are more or less deprecated. You can alterantively use the Lotus Connector classes. This is a different set of classes and you need to recode quite a bit but otherwise it provides the same (and more) functionality.

In addition, when using the Lotus Connector API, you do not need to define ODBC DSNs externally to Domino/Notes. Instead, the connection data is specified completely within the agent(s). In case of DB2 (as for your AS/400), you just need to have the database cataloged in your DB2 client (but that you need for an ODBC DNS to DB2, too).
1. My server is Windows 2003 R2
2. I changed the code to this
Sub Initialize
	Set con = New ODBCConnection
	
	Print  "Before connection to AS400"
	If con.ConnectTo("AS400", "MyUserID", "mypassword") Then
		Print  "Connection successful to AS400"
       Else 
                Print "Can't connect to AS400"
	End If	
End Sub

Open in new window


I scheduled the Agent but the agent didn't run and all the Test Agent that was scheduled to run yesterday on the server still show up as running on the server task. And now I cannot view my scheduled agent in the Administrator, it shows up blank when I go to Server > Schedules > Agents. This is frustating...
Check the schedules with a "tell amgr sched" command into the Domino console.
On the "Server Tasks" tab in the Domino Administrator, you need to refresh yourself with F9 from time to time. It does not refresh itself.

Are you the Domino admin yourself? If not, ask him/her to check what happened to the agent manager.
If you _are_ the admin, then it would be a good time to schedule a course or get a good book about it ...
I tried to use "tell amgr sched" but got back with this:

The AMGR task either does not exist or foes not accept "Tell" commands

I'm just filling in right now until we get a new person. The admin is no longer with the company.
Then the Agent Manager is not running. You can verify this with "show tasks".
Check in the output, if there really is no agent manager task.
In this case, start it with "load amgr".
I just want to update the status in here. The problem is solved, once I set up the ODBC connection in the System DSN, added the AS400 ID and password in the code, and restarted the server, I was able to make the connection.

But a few things:
1. I used 'show tasks' to see if Amgr is running and it said it was running when the agent stalled. I had IBM support to look at it but they weren't sure either why it happened.
2. Is Lotus Connector available on Domino 7.x ? (Yeah I know we need to upgrade ... still waiting for the fund to come down ^^ )
I don't know what happened to your AMgr. If that problem repeats, I would raise another PMR.

Yes, the Lotus Connector API is already there for quite a few years. I may already have been even in 6.5.