In some scenarios the developer may have an existing database or an existing template to create a data database from. If not, a database needs to be created. One option is to have a blank template on the server and use that. For creating a database from a template there are pre-existing APIs in the Database class -
If not, ODA has added APIs to create a new database from an empty ODS 52 NSF that has minimal design elements and ACL settings. There are two new methods:
Session.createBlankDatabase(filePath)allows a new database to be created / retrieved in the Data directory of the server / workstation running the code. The parameter is the folder and filename. If the filename is missing a ".nsf" or ".ntf" suffix, that gets automatically appended. If no database exists at that location, one is created and retrieved. Otherwise the database at that file location is returned.
Session.createBlankDatabase(DbDirectory, filePath)allows a new database to be created in the Data directory of another server. The first parameter is the DbDirectory object for the server on which to create or retrieve the blank database. Otherwise it works the same as previously.
Session.createBlankDatabaseAbsolutePath(filePath)allows a new database to be created in a specific location, e.g. C:\Temp.
The APIs use DbDirectory methods to create the database running as the server.