openWithFailover (NotesDatabase - JavaScript)

Opens a database on a server.

Defined in

NotesDatabase

Syntax

boolean openWithFailover(server:string, dbfile:string) : boolean
Parameter Description
server The name of the primary server on which the database resides.
dbfile The file name of the database to open.
Return value Description
true indicates that the database exists and was opened.
false indicates that there is no database with this name in the cluster.

Usage

The Server and FilePath properties reflect the actual server on which the database is opened.

If the database can't be opened on the specific server but the server belongs to a cluster, openWithFailover automatically looks for a replica of the specified server on the same cluster. If the method finds a replica, that database is opened instead, and the Server property adjusts accordingly.

Examples

This button opens names.nsf on a server, but fails over if the server is in a cluster and another server contains the database.
var db:NotesDatabase = session.getDatabase("", "");
if (db.openWithFailover("NotesUA/Westford/Notes", "names")) {
	requestScope.status = "Names.nsf opened on " + db.getServer();
} else {
	requestScope.status = "Names.nsf not opened";
}