CPP API Problem

HI All,

I have a domino server which I can connect with the Notes

client. However, I cannot connect using my app written using

C++ API. The NSFDBOpen method returns:

Unable to find path to server … and the error code is 2051.

Any info is much appreciated.

TIA.

VLAD

Subject: CPP API Problem

Can you post some code please?

Subject: RE: CPP API Problem

Its a dll so the following are the first two methods. The firstis the open method and the second one is trying to get the

database list. The second method fails on the NSFDBOpen

call.

JNIEXPORT void JNICALL Java_Notes_Open

(JNIEnv *env, jobject obj)

{

STATUS error = NOERROR;

char ** args = (char **)malloc(2);

// get the ini file to use from the registry.

// Need to have an argument list of two arguments

// because the api is normally called by passing in

// argc and argv where argv[0] is the executable

// and argv[1] is the ini file.

args[0] = getRegistryValue

    ("SOFTWARE\\JavaSoft\\Prefs\\astis\\nid", "notesini");

args[1] = args[0];

// Initialise notes environment.

error = NotesInitExtended( 2, args );

// If notes has not been initialised

if ( error )

{

  DWORD dw = GetLastError();

  LPVOID lpMsgBuf;

  FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |

  	    FORMAT_MESSAGE_FROM_SYSTEM,

                NULL, dw, MAKELANGID(LANG_NEUTRAL, 

                SUBLANG_DEFAULT),

                (LPTSTR) &lpMsgBuf, 0, NULL );

  log(false, (char *)lpMsgBuf);

  ThrowNotesException(env, error, "NotesInitExtended", 0 );

  return;

}

}

void ReadServerDBs(struct ServerSearch *searchInfo )

{

// Path to the server data directory

char serverPath[MAXPATH];

// Handle to the database data directory

DBHANDLE dataPath;

// Operation result of NOTES commands

STATUS error = NOERROR;

// Compose the full network pathname to the directory

error = OSPathNetConstruct(NULL, searchInfo->server,

   searchInfo->path, serverPath);

if ( error )

{

  ThrowNotesException( searchInfo->env,

      error, "OSPathNetConstruct", searchInfo->path );

  return;

}

// Open the directory.

error = NSFDbOpen (serverPath, &dataPath);

if ( error )

{

  ThrowNotesException( searchInfo->env,

       error, "NSFDbOpen", serverPath );

  return;

}

TIA

Vlad

Subject: RE: CPP API Problem

Does the serverPath variable contain what you expect it to contain?

Could it be something as simple as not being able to look up the server in DNS? If you have a connection document for the server in the Notes client (which contains the server’s IP address) the client app will find a path, but when you do it in CPP it is unable to find the server’s IP address because the connection document isn’t usable…