[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1912
  • Last Modified:

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?
0
coronoahcoro
Asked:
coronoahcoro
  • 7
  • 5
  • 2
  • +1
3 Solutions
 
Sjef BosmanGroupware ConsultantCommented:
A scheduled agent runs on the server. So indeed, you need to set up an ODBC connection on the server as well.
0
 
KStannardCommented:
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.
0
 
coronoahcoroAuthor Commented:
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?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
coronoahcoroAuthor Commented:
Below is the message on the Server Task:

Agent Manager        Executive '2': Running agent 'Test agent' in 'DatabaseName.nsf' [namgr]
0
 
coronoahcoroAuthor Commented:
Is it because of the MessageBox? Shoot ...
0
 
coronoahcoroAuthor Commented:
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.
0
 
Sjef BosmanGroupware ConsultantCommented:
What type of server do you have? If it's not a Windows server, are you sure it can speak ODBC as a client??

MessageBox is no problem, it logs on the console.

What might also be a problem is that the code after the errorhandler label is always executed. Another problem is that the server is not a user, so you might need the 2nd and 3rd parameters of the ConnectTo call (user and password).
0
 
KStannardCommented:
sjef_bosman is on the money, it might be an access rights issue on your AS400. I don't see a username/password being parsed in your code. Can you access the data you need based on default access rights? I'm a Notes admin rather than a developer, and not a iSeries person, but from memory you should be able to use a profile to access on the AS400 rather than a specific user account with all the requisite access rights. I hope I have got the terms right there!  You will then need to then parse the profile name as the username and the password in your code.  If you are not getting as far as the message "Before connection to AS400" then maybe it's not completing the connection to the AS400 due to authentication issues.
Sorry, it's a long time since I had to deal with a Notes to AS400 connection and I've forgotten a lot. And I don't have access to the code any more either.
0
 
wuesten_fuchsCommented:
The user ID and password for the ODBC connection could be stored within the DSN ... but if not, you need to pass them with the con.ConnectTo call.

In any case, the DSN must be defined locally on the (Windows) server as a System DSN.

An "Exit Sub" needs to go before (!) the error handler, as noted above. Otherwise it is always executed, even if there is no error. In addition, the "Exit Sub" in (!) the error handler better should be an "End" statement. Also, there should not be a need for con.Disconnect there.

And while the MessageBox may be automatically converted into a Print statement (not 100% sure about this) in a background agent, it usually is better style to use a Print statement directly. When run interactively in the client, you can see Print output in the Debugger or on the Notes client status line. On the server, it goes to the Domino console.
0
 
wuesten_fuchsCommented:
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).
0
 
coronoahcoroAuthor Commented:
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...
0
 
wuesten_fuchsCommented:
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 ...
0
 
coronoahcoroAuthor Commented:
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.
0
 
wuesten_fuchsCommented:
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".
0
 
coronoahcoroAuthor Commented:
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 ^^ )
0
 
wuesten_fuchsCommented:
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.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 5
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now