getDatabase (NotesSession - JavaScript)

Creates a NotesDatabase object that represents the database located at the server and file name you specify, and opens the database, if possible.

Defined in

NotesSession

Syntax

getDatabase(server:string, db:string) : NotesDatabase

getDatabase(server:string, db:string, createonfail:boolean) : NotesDatabase

Parameter Description
server The name of the server on which the database resides. Use null to indicate the session's environment, for example, the current computer.
db The file name and location of the database within the Domino® data directory. Use a full path name if the database is not within the Domino® data directory.
createonfail If true or omitted, creates a NotesDatabase object even if the specified database cannot be opened. If false, returns null if the database cannot be opened.
Return value Description
NotesDatabase A NotesDatabase object that can be used to access the database you have specified, or null if the database cannot be opened and createonfail is false. If the database cannot be opened and createonfail is true or omitted, isOpen is false for the NotesDatabase object.

Usage

See the NotesDatabase class for additional descriptions and examples.

Examples

This computed field returns the title of names.nsf in the local directory.
var db:NotesDatabase = session.getDatabase("", "names", false);
if (db == null) {
	return "No local address book";
} else {
	return db.getTitle();
}