URGENT - GetDatabase() not returning

Hi,

I’m using C# and the GetDatabase() method in COM while trying to use names.nsf on the server in this format :

serverdatabase = _lotusNotesServerSession.GetDatabase(DominoServer, “names.nsf”, false);

(DominoServer is a variable holding the server name)

Everything works fine if the server exists. However, if a non - existent server is used, then the call does not return at all. My program execution stops at this line until I terminate it.

Can anyone direct me to a better “crash-proof” method of doing this ?

Thanks in advance !!!

Subject: URGENT - GetDatabase() not returning

First, you can try GetDbDirectory(server), traversing results via GetFirstDatabase and GetNextDatabase. It might work…

Most likely there is a long server lookup than a real hangup.

If the server name is IP address, you can ping it before doing any attempts to connect.

As a last resort, place GetDatabase in a separate thread and kill it after a reasonable timeout. It is less dangerous than it seams, because there is no connection to the server at the moment. Close current Notes session after thread termination to clean up.

Rather than allowing users to type server name, why not provide them with a list of available servers? Could be done via .NET LDAP utilities, they will not hang on invalid LDAP server :slight_smile:

Subject: RE: URGENT - GetDatabase() not returning

Hi Svetozar,

I tried the GetDbDirectory() method. Same results here too :(.

Yes, you are right. There is a VERY long server lookup, instead of a hangup. Funny thing is, the Notes client returns pretty quickly if we give it a wrong server name. But the COM api’s don’t !

I tried using a Timer as well as a seperate thread. The problem with this approach is that the thread can’t seem to be terminated, coz the COM component refuses to be released !

Regarding the LDAP part… what if the server does not exist on LDAP ?

Any pointers ?

Thanks in advance !!!

Daman

Subject: RE: URGENT - GetDatabase() not returning

Hi Daman,

LDAP was just an example how to collect and offer to user valid server names, thus preventing hangups.

Subject: URGENT - GetDatabase() not returning

Hi Daman,

 Have you tried checking the variable/object 'serverdatabase' for validity before using it in the program? something like:

serverdatabase = _lotusNotesServerSession.GetDatabase(DominoServer, “names.nsf”, false);

'check for the validity of serverdatabase

if serverdatabase is nothing then

msgbox ‘couldn’t get a handle to the database!’

exit sub

end if

   (or) 

if(serverdatabase=“”) then

msgbox “couldn’t get a handle to the database!”

exit sub

end if

p.s i’m not sure, how you check a variable for null condition in C#. use appropriate condition.

Hope it helps,

Jason

Subject: RE: URGENT - GetDatabase() not returning

Hi Jason,

I could do that IF the program proceeded beyond that line !!! the program just stays at that particular line, like forever !!!

( serverdatabase = _lotusNotesServerSession.GetDatabase(DominoServer, “names.nsf”, false):wink:

I have made all necessary checks to ensure that the variable DominoServer is not empty.

Again, just a reminder, this setup works fine if a CORRECT domino server is used. I want to exit gracefully if the server is non-existent or wrong.

The idea is that I want to connect to any domino server, provided the server name/ip is supplied.

Any other ideas ?

Thanks in advance !!!