Replication of this database is not permitted

I recently investigate an replication issue with an application that refuses to replicate. Not only that the regular replication failed but also the initial

replication after the replication stub was created on the target server.

I ensured that the ACL was set correct and also ensured that the “temporarily disable replication” flag was not set.
Despite all settings seemed to be OK, the application still refuses to replicate to the target server.

After calling Google to the rescue, I found this article by Tony Patton http://www.dominopower.com/issuesprint/issue199904/enhance.html. Cannot figure out the release date but it describes the NotesReplication class methods and properties, intruduces as of Release 5 of Lotus Notes and Domino.

In the article “NeverReplicate” is mentioned as a property. This looked promising because the property best describes the issue that I saw.

So I wrote a few bits and pieces to find out the value for this property in the current database.

Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim rep As NotesReplication
Set db = session.CurrentDatabase
Set rep = db.ReplicationInfo
Msgbox rep.NeverReplicate
End Sub

Unfortunately the code throws an error on save: “Not a member: NOTREPLICATE”. And even the Designer help does not mention this property.

So I digged into the CAPI documentation and found this information.

#include <nsfdata.h>


REPLFLG_NEVER_REPLICATE
 – If set, the Server’s Replicator Task Ignores this database. Enable replication by clearing this bit. Since this can only be done programatically, it is a more bullet-proof method than REPLFLG_DISABLE, which can be modified from the user interface.

With this information at hand, I put together some code to set or unset this property using LS2CAPI. Here is what I ended with.

Option Public
Option Declare

%Include "LSERR.LSS"

Const REPLFLG_NEVER_REPLICATE = &h0100

Type TIMEDATE
Innard1 As Long
Innard2 As Long
End Type

Type DBREPLICAINFO
ID As TIMEDATE
flags As Integer
CutoffInterval As Integer
Cutoff As TIMEDATE
End Type

Declare Function W32_NSFDbOpen _
Lib "nnotes.dll" Alias "NSFDbOpen" _
(ByVal dbName As String, hDb As Long) As Integer
Declare Function W32_NSFDbClose _
Lib "nnotes.dll" Alias "NSFDbClose" _
(ByVal hDb As Long) As Integer
Declare Function W32_NSFDbReplicaInfoGet _
Lib "nnotes.dll" Alias "NSFDbReplicaInfoGet" _
(ByVal hDB As Long, retReplicationInfo As DBREPLICAINFO) As Integer
Declare Function W32_NSFDbReplicaInfoSet _
Lib "nnotes.dll" Alias "NSFDbReplicaInfoSet" _
(ByVal hDB As Long, retReplicationInfo As DBREPLICAINFO) As Integer


Class NotesReplicationSettings
Private hDb As Long
Private retReplicationInfo As DBREPLICAINFO
Private prvdb As NotesDatabase
Private flgDBExist As Integer

Sub Delete
If hDb <> 0 Then Call W32_NSFDbClose(hDb)
End Sub

Sub New (inpNotesDatabase As NotesDatabase)
Dim sDatabase As String
Dim uaesession As New NotesSession
Dim rc As Integer
Me.flgDBExist = False
If inpNotesDatabase Is Nothing Then
Error 14104, "Database Object is invalid"
Exit Sub
End If
Set prvdb =_
New NotesDatabase(inpNotesDatabase.Server, inpNotesDatabase.FilePath)
If (prvdb.Server = "") Or (uaesession.IsOnServer) Then
sdatabase = prvdb.filepath
Else
sdatabase = prvdb.server + "!!" + prvdb.filepath
End If
rc = W32_NSFDbOpen(sDatabase,Me.hDb)
If rc <> 0 Then
Me.flgDBExist = False
End If
rc = W32_NSFDbReplicaInfoGet(Me.hDb, Me.retReplicationInfo)
If rc <> 0 Then
Me.flgDBExist = False
End If
Me.flgDBExist = True
End Sub

Private Function DBExist As Integer
DBExist = Me.flgDBExist
End Function

Public Function NeverReplicate(sFlag As Boolean) As Boolean
Dim puActivity As Long
Dim rc As Integer
If Not Me.flgDBExist Then
Error 14104, "Database not opened"
NeverReplicate = False
Exit Function
End If
If sFlag Then
Me.retReplicationInfo.flags =_
(Me.retReplicationInfo.flags _
OR REPLFLG_NEVER_REPLICATE)
Else
Me.retReplicationInfo.flags =_
(Me.retReplicationInfo.flags _
And Not REPLFLG_NEVER_REPLICATE)
End If
rc = W32_NSFDbReplicaInfoSet(Me.hDb, Me.retReplicationInfo)
If rc <> 0 Then
Me.flgDBExist = False
End If
End Function

Public Property Get ReplicationFlags As String
ReplicationFlags =  Me.retReplicationInfo.flags
End Property
End Class

Use the following code to unset the REPLFLG_NEVER_REPLICATE flag.

Sub Click(Source As Button)
Const REPLFLG_DISABLE = &h4
Dim session As New NotesSession
Dim db As NotesDatabase
Dim rep As NotesReplication
Set db = session.CurrentDatabase
Dim rs As New NotesReplicationSettings(db)
Call rs.NeverReplicate(False)
End Sub

After setting the property to “always replicate” the application replicated as expected.

I don’t have a Release 5 client available. Jus wonder what happens to some of the properties described in the article. Some of them like the “DoNotCatalog” had been added to the NotesDatabase class in Release 6. Obviously the “NeverReplicate” has been forgotten.

One thought on “Replication of this database is not permitted

  1. I have asked IBM about the NeverReplicate property. Here is the answer:

    “… an error in the article.

    The NeverReplicate property was not removed. It has never been available via the back end.

    I created an enhancement request ESAR8G9HV9 to record the request for this property in a future, feature release.”

    So if you find that this property could be useful and you have a business case, add yourself to the request.

Comments are closed.