Manage Learn to apply best practices and optimize your operations.

Opening a database on a server with a replicaID when using LotusScript


LotusScript does not provide a method to open a database on a server with the replicaID. You must know the name and path of the file where the database is. However, in a large international organization you may not always have control of the path to the database on other servers, making the only reliable information you have the replica id.


The script can be placed in the script library or used in situ to provide a handle on the database object, if you can provide the server where the database is and the replica id.

' Written by Kevin Rourke of JacTec Consultancy
' Code used to return a notes database object representing the database
with the
' replicaid and on the server passed to the function
' Nothing is returned if the database cannot be found
' Calling code and useful code
' ************************************

' this code finds a database on the same server as the current database
' and opens it allowing access to it's objects
Dim session As New notessession
Set db = session.currentdatabase
Set anotherdb = FindDatabaseObject(db.server, replicaid)
Call anotherdb.Open( "", "" )

Dim db As notesdatabase
Dim anotherdb As notesdatabase
Dim ndb As notesdatabase

Function FindDatabaseObject (servername As String, dbreplicaid As String)
As notesdatabase
     Dim dbdir As New NotesDbDirectory(servername )
     Set ndb = dbdir.getfirstdatabase(database)
     Print "Searching for database on " & servername
     While Not ndb Is Nothing
          If ndb.replicaid = dbreplicaid Then
               Set FindDatabaseObject = ndb
               Print "Found database " & ndb.title & "on " & servername
          End If
          Set ndb = dbdir.getnextdatabase
          Print "Database cannot be found on server " & servername
          Set FindDatabaseObject = Nothingbye
End Function

Dig Deeper on LotusScript



  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...