Working with dBase databases

From NeoWiki

Jump to: navigation, search

It is possible to use your existing dBase database files (.dbf) with NeoOffice, either directly as a data source in Base or indirectly by importing the DBF file into Calc.


[edit] Connecting to DBF files in NeoBase

You can use Base to connect to one or more DBF files.

  1. Go to the File menu and choose New and then Database
  2. In the first pane of the Database Wizard, choose Connect to an Existing Database
  3. Set the drop-down to dBase
  4. Click Next>>
  5. In the next pane, click on the Browse button
  6. Navigate to the folder in which the .dbf files are found
    • You cannot choose a file, you must select a folder.
  7. Click Open
  8. Click Next>>
  9. In the Save and Proceed pane, select the settings as desired
  10. Click on Finish

[edit] Creating a dBase database with NeoOffice Secure Edition

To create a dBase database in Base with NeoOffice Secure Edition (NeoOffice 2013/2014), you only need to do either of the following:

  1. Select the Create new database radio button in the Database Wizard dialog as shown in this screenshot. Instead of embedding an HSQLDB database inside a new .odb file, your new .odb file will point to a new folder in your ~/Library/Containers/org.neooffice.NeoOfficeSecureEdition/Data/Documents folder (note: "~" means your Home folder).
  2. If you don't like your dBase folder being buried in a hidden folder, you can create a new dBase database by simply creating an empty folder in the Finder. Then, in NeoOffice's Database Wizard dialog, select the Connect to an existing database radio button and select dBase from the listbox. Press the Next button and select the empty folder that you created.

The key things to remember when using a dBase database is the following:

  • Like MySQL, the actual database is not in the .odb file. The .odb file only stores the location of the actual database and any Base forms that you create.
  • dBase is a single user database so be careful if you put the dBase database folder on a shared volume. If edits are made on two different machines at the same time, you can corrupt the database files.

[edit] Importing a DBF file into Calc

When importing a DBF file into Calc, you may experience a problem where numeric values are converted into text characters.

The table structure of the DBF file says all the fields containing leading apostrophes are text characters. This can easily seen if you import the DBF file and look at the first row. Each column has a header defining its data type; C is for characters (text), whereas N is for numeric (values).

So Calc imports any numbers in columns with C headers correctly (according to what the dBase file has specified) as text characters. Since the number format for the default Calc template is set to Number, an apostrophe is placed in front of this imported value to ensure it is treated as Text instead.

To change such text values to real numeric values, you have several choices:

[edit] Issues with DB2K files

Older DBF files in the DB2K format are not compatible with NeoOffice or When a connection is made to the file, most fields will show <OBJECT> for data in Base and #N/A in Calc. If you have a Windows machine available, the solution is to use the dbf-converter program to convert these files to dBase-IV format, which NeoOffice does support.

[edit] References

This article in other languages: Français
Personal tools