When creating a new database, you need to select the database kind: project database or binary database.
Regarding development, selecting a database kind is mainly a matter of internal architecture: whatever the selected kind, 4D development environment, available editors, or features (with some exceptions, see below) are identical.
Note that you can convert a binary database to a project database, but not the opposite. See the Converting databases to projects section.
Compatibility Note: The Database... and Database From Structure Definition... items are not displayed by default (4D recommends to use the project architecture for new development). To display them, you need to check the option in the Preferences.
In this architecture, introduced in 4D v18, the whole database design is exploded in multiple separate, text-based files, using json or xml. Databases can be compiled and deployed in a single compressed .4dz file. This architecture is recommended by 4D for new developments, since it provides the following advantages:
Source control compliance: 4D project files are particularly well suited to be managed by a source control repository (Perforce, Git, SVN, etc.), allowing development teams to take advantage of their main features, i.e. versioning, revision comparison, and rollbacks. This compliance allows new developers to keep their working environment because source control is very common in the software industry.
Human readable code: database code, including table definitions, methods, or forms, is stored as open text files that can be read and handled through any framework or text software.
Lightweight client-server distribution through a single compressed .4dz file -- note that this technology does not allow team development on a 4D Server database (.4dz file is read-only).
Extra features availability: project architecture relies on the most recent system libraries(*) and provides additional features, in particular:
better management of dynamic entry order in form editor
This is the traditional 4D database file architecture. In this architecture, the whole database design, including database structure, forms, or code, is stored within a single .4db file. Compiled files are .4dc files. It was the only available file architecture until 4D v18 and has proven its efficiency. You can create a new blank binary database or a new binary database from a structure definition.
Choose New > Project Database... from the File menu or form the menu associated with the New button in the 4D tool bar. A standard Save as dialog box appears.
Choose the name and location of the main project folder:
Click Save. The project folder and its subfolder hierarchy are created at the specified location. For a detailed description of the project subfolder hierarchy, please refer the Architecture of a project page on developer.4d.com. The 4D application window is then displayed with the Explorer in the foreground.
Compatibility Note: The Database... and Database From Structure Definition... items are not displayed by default (4D recommends to use the project architecture for new development). To display them, you need to check the option in the Preferences.
You can create a blank database, i.e. that does not contain any tables, fields or forms. Its the equivalent of a blank sheet for databases.
To create a blank database:
Choose New > Database... from the File menu or from the menu associated with the “New” button in the 4D tool bar. A standard Save as dialog box appears so that you can choose the name and location of the 4D package:
Enter the name of your database and click Save. You can choose any file name allowed by your operating system. Warning: if your database is intended to work on other systems, you must take the specific restrictions for each of them into account. For example, "backslash" (\) characters are accepted under OS X but they are not allowed under Windows.
When you validate the dialog box, 4D closes the current database (if any), creates a folder at the location indicated (the name of the folder is the database name) and puts all the files needed for proper operation of the database into it. For more information about the architecture of 4D databases, refer to Database Architecture.
The 4D application window is then displayed with the Explorer in the foreground. You can then, for example, create project forms or display the Structure editor and add tables, fields, etc.
Compatibility Note: The Database... and Database From Structure Definition... items are not displayed by default (4D recommends to use the project architecture for new development). To display them, you need to check the option in the Preferences.
Structure definitions that are exported in XML format can be used to create new identical databases on the fly. In this case, the structure definition can be considered as a structure template, which can be duplicated at leisure. For more information, refer to Exporting and importing structure definitions.
An XML structure definition can be used as is or can be modified beforehand via an XML editor. This means that the use of any type of mechanism used to generate structures by programming can be considered.
Furthermore, since the internal format of 4D structure definition XML files is public (see Format of a 4D structure definition), it is possible to build this type of file from other database environments or any design application in order to generate 4D databases automatically.
To create a binary database from a structure definition:
Select New > Database From Structure Definition... from the File menu of 4D or from the menu associated with the “New” button in the 4D tool bar. A standard Open document dialog box appears so that you can specify the definition file to be opened. You must select an XML format file that respects the “grammar” of 4D structure definitions (the program validates the file via the DTD).
Select a structure definition XML file then click OK. 4D displays a dialog box that can be used to choose the name and location of the database to be created.
Choose the name and location of the database to be created then click on Save.
If the XML file is valid, 4D closes the current database (if any) and creates a new structure based on the structure definition. A folder is created at the location indicated (the name of the folder is the database name) that contains all the files needed for proper operation of the new database. The Explorer window then appears.
Note: It is not possible to create a project database from a structure definition.