getFirstDatabase (DbDirectory - Java)

Returns the first database from a server or the local directory, using the file type you specify.

Defined in



public Database getFirstDatabase(int type)
    throws NotesException


int type

Indicates the kind of database file you want to retrieve:

  • DbDirectory.DATABASE means any database (NSF, NSG, or NSH file).
  • DbDirectory.TEMPLATE means any template (NTF file).
  • DbDirectory.REPLICA_CANDIDATE means any database or template not disabled for replication.
  • DbDirectory.TEMPLATE_CANDIDATE means any database or template.

Return value


The first database of the specified file typelocated in the directory, or null if the directory contains no databases of the specified type.


The returned database is closed. If you do not open the database, only a subset of its methods are available. See isOpen in Database.

Each time you call this method, the database directory is reset and a new search is conducted. If you are searching for template files, for example, a new call to getFirstDatabase with the parameter DATABASE starts searching the directory from the beginning, this time for database files