KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Datafile Placement Suggestions
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: May 2, 2025

When deploying a 4D Database, one key decision is where to place the datafile. By default, if a new database structure is created or opened without an associated datafile, 4D prompts the user to either open an existing datafile or create a new one. If a new datafile is created, the file explorer or Finder may default to the last-used directory, which could be the location of the database structure.

While placing the datafile within the same parent directory as the database structure can make management more straightforward, it is recommended to store the datafile in a separate directory, especially in deployment scenarios. This approach is particularly important for built applications.

Benefits of Separating the Datafile and Database Structure:

  • Safer Updates: Separating the datafile ensures that the database structure can be replaced, deleted, or moved without affecting the datafile.
  • Read/Write Accessibility: The datafile requires a location with read/write access. Some deployments install the built application in protected directories, such as Windows' Program Files or macOS's Applications folder, which may restrict datafile access.
  • Enhanced Flexibility: Keeping the datafile in a separate directory allows for easier management and maintenance, reducing the risk of accidental data loss during updates or reinstallation.
For these reasons, it is recommended that the datafile be stored in a separate directory from the database structure or built application.