Manage Learn to apply best practices and optimize your operations.

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

Problem:

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.

Solution:

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
' ************************************

%REM
' 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( "", "" )
%END REM

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
     Wend
          Print "Database cannot be found on server " & servername
          Set FindDatabaseObject = Nothingbye
End Function

Dig Deeper on LotusScript

Join the conversation

2 comments

Send me notifications when other members comment.

Please create a username to comment.

I want to javascript to send a mail through lotus notes.But Im not getting any help regarding that ....Im creating a website which sends mail to the respective user just like forgot password....we enter the mail id and the password is sent to the entered mail..can you pls hlp me with the code to do so ....I've tried searching every where bt was not able to find a solution
Cancel
I want to javascript to send a mail through lotus notes.But Im not getting any help regarding that ....Im creating a website which sends mail to the respective user just like forgot password....we enter the mail id and the password is sent to the entered mail..can you pls hlp me with the code to do so ....I've tried searching every where bt was not able to find a solution
Cancel

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com'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 ...

SearchDataCenter

SearchContentManagement

Close