|
Working with dBase databases
From NeoWiki
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.
Contents |
Connecting to DBF files in NeoBase
You can use Base to connect to one or more DBF files.
- Go to the File menu and choose New and then Database
- In the first pane of the Database Wizard, choose Connect to an Existing Database
- Set the drop-down to dBase
- Click Next>>
- In the next pane, click on the Browse button
- Navigate to the folder in which the
.dbf
files are found- You cannot choose a file, you must select a folder.
- Click Open
- Click Next>>
- In the Save and Proceed pane, select the settings as desired
- Click on Finish
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:
- 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). - 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.
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:
- Two options are described in Converting a Text String to a Number in Calc.
- You can also change the field setting in the DBF from C to N and re-import the file.
Issues with DB2K files
Older DBF files in the DB2K format are not compatible with NeoOffice or OpenOffice.org. 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.
References