Using a config doc for DB path HELP

Hi there -

I have a config doc with db name and path in it, my LS agent using the config doc to find the path and db name …and then opens the db.

I think i have the syntax int the config doc. field wrong - and cant’ recall how you are suppose to enter it.

The LS agent finds the fields on the config doc and retrieves the values - just doesn’t open the DB.

what is the exact syntax I should put in teh config doc field…

ie. If the DB is located in DirectoryA with a filename of XYZ.nsf and on the server CANDB01/UT/CO how exactly should i be entering it into the fields on the config document.

DB Name field: directoryA\XYZ.nsf

DB Server: CANDB001/UT/CO

many thanks…

Subject: RE: Using a config doc for DB path HELP

There’s no obvious problem with the information you show, but there’s no one right way to store information in a configuration document. It all depends what the code that reads it, does with it. But you don’t show that code, so there’s no way to know.

What makes you think it’s not working? Do you get an error? What error, on what line?

See link below about how to debug your problem and what information to include if you still have a question after debugging.

  • Andre Guirard, IBM/Lotus Development

Useful blog: Best Practice Makes Perfect

For faster answers, be C R I S P Y

Subject: RE: Using a config doc for DB path HELP

I do a test before processing to see if the db is open and it fails…see below.

'Retrieving the name and location of the SWAT DB

Set Configview = V2Vdb.GetView("Config")

Set Configdoc = Configview.GetFirstDocument

Servername = Configdoc.servername

DBName = Configdoc.DBName

'Get the SWAT database instance

Set SWATdb = session.GetDatabase(ServerName(0), DBName(0))

'If we can’t find the SWAT DB exit the whole agent

If Not SWATdb.IsOpen Then

	Print "The V2V Push to SWAT agent could not find SWAT DB"

	Exit Sub

End If

Subject: RE: Using a config doc for DB path HELP

I do this all the time but I use profile document to store config information and I always use OpenByReplicaID rather than passing a file name. There is no disadvantage to the method that you use other than the fact that you create an unecessary view in your database. Here is the code I always use to perform the same task:

dim TargetDB As New NotesDatabase(“”,“”)

dim ThisDB as NotesDatabase

dim session as New NotesSession

dim Settings as NotesDocument

set ThisDB = session.CurrentDatabase

set Settings = ThisDB.GetProfileDocument(“GlobalSettings”)

if not TargetDB.OpenByReplicaID(Settings.TargetServer(0), Settings.TargetReplica(0)) then

msgbox “Oh crap”

Exit Sub

end if

… REST OF CODE …

Hope this helps you.

Subject: RE: Using a config doc for DB path HELP

Dave - thank you so much for you tip :slight_smile:

Subject: RE: Using a config doc for DB path HELP

I second Dave’s recommendation of a profile document (though I have mixed feelings about the replica ID advice), but that’s not the source of your problem. I refer you again to the C_R_I_S_P_Y document, especially point I, TEST YOUR INPUTS.

Did you debug to make sure the values in the variables were really what you thought? The behavior you describe is exactly what happens if you supply a nonexistent or blank server/database name. Are you sure the values are stored in the fields Servername and DBName?

If that doesn’t solve it, there’s still a lot of information you haven’t supplied. Please review the checklist to see what other information might be helpful.

Subject: RE: Using a config doc for DB path HELP

Thanks for you advice Andre - I did have a typo in my server name (doh!)