0
votes

I have a lot of Lotus Notes / Domino (version 7) database to migrate to a new software. On my workstation (with Lotus Notes installed), I'm using a standalone Java application to connect to a local replica an extract data. However the replication of the distant database is still a manual process. I'd like to automatise it.

My java code basically looks like this :

Session localSession = NotesFactory.createSession(); // With Notes thread initialized
Session remoteSession = NotesFactory.createSession(SERVER, USER, PASSWORD);

Database localDb = localSession.getDbDirectory(null).openDatabase("local_name", true);
Database remoteDb = remoteSession.getDbDirectory(null).openDatabaseByReplicaID(REPLICA);

//    ***EDITED CALLING INSTANCE BELOW***
remoteDb.createReplica(null, "local_name"); // Error thrown here

However the last line throws an exception (from memroy, but something like)

CN=****/***** does not have the right to create database on a server

How is it possible that I don't have the right to create database on my local computer ?

Is there any other way to programmaticly create a local replica from a distant database ?

Edit: changed calling instance of create replica to match my code causing the issue

2

2 Answers

0
votes

My guess is that it's just giving you the wrong error message. One thing that's definitely wrong is that he first argument for createReplica should be an empty string, not a null pointer. I.e., try this:

localDb.createReplica("", "local_name"); 
0
votes

Ok it looks like I found the answer.

AFAIU I had to open the database on the target server, using my local session, and run the createReplica() from here. This way, the createReplica is executed on my local Lotus Notes server, and the replica is created locally.

Session     localSession        = NotesFactory.createSession((String)null, (String)null, PASSWORD);
DbDirectory remoteDbDirectory   = localSession.getDbDirectory(remoteSession.getServerName());           
Database    localSessionRemoteDatabase = remoteDbDirectory.openDatabaseByReplicaID(REMOTE_REPLICA_ID);          
localSessionRemoteDatabase.createReplica("", LOCAL_FILE_NAME);

@Richard Schwartz Can you confirm this is ok ?

The only weird thing, is that it opens a prompt (like when it's expecting password) but the replica is created. The process is executed within Eclipse.