file2db utility

file2db is command line program intended for loading files into the database.

There are two versions available: file2db_ib for Interbase and Firebird and
file2db_ado for other SQL database servers. You need Interbase client library
(gds32.dll) installed or ADO database driver for you database installed on your
system.

To load list of text strings specify field (attribute) delimiter and list of attributes:

file2db_ib -L <delimiter> -f <fields>

To load file entirely into BLOB field, specify options:
name of BLOB field and optionally field for keeping name of loaded
file and MIME type of the file.

will be loaded. If you want load all files from the directories, specify
–a option.

Option –y (–Y) set table attribute where MIME type must be stored.
If file2db can not determine MIME type of the file,
text/html MIME type is used. To override default MIME type use –z option.

For -L command -2 < line number > option sets
line number (starting with 1) from which data must be loaded.
It is useful in case when text file starting with header- in this case use option value -2 2.
By default value of this option is 1.

fil2db process Excel worksheet files if Microsoft Office is installed (at least of 2000 version or later).
-1 < line number > set row number where table fields (attributes) are listed.
By default value of this option is 1.

Excel worksheet consists of one or more sheets corresponing to the different tables.
Name of each sheet MUST be the same as database table name.

Loading data from the Excel therefore are a little bit tricky.
You must remove all empty sheets, and correctly named all other sheets.

Loading data from the Excel is intended especially fo avoiding –f option,
because corresponing attributes are listed in the sheet.
Note you must set -1 and -2 options both.

Excel table can contain columns with data with no data to be loaded. file2db first
find out row with field list by -1 option value and then set left and right
limits from which data 'll be loaded.

By default BLOB data extracted into the current directory (–X command).
You can set output directory by -o option.

file2db provides two options for file name manipulation stored in the database.
You can add suffix to the file name by -u option.
You can remove prefix from the file name by -m option and add new prefix by-q option.

Often clear data from the database is required before loading data.
For Interbase/Firebird you can use isql command line utility to do.
file2db use –i option to clear data from the table (–N и -L commands) BEFORE loading or
AFTER extraction (-X command).

Passing parameters is possible thru QUERY_STRING environment variable.
This feature is useful when file2db is called from the web (GET method) using
–g option or reading command line from the stdin file using –p opton (POST method).
In both cases all other options passed as url-encoded like x=&o=path

file2db uses initialization file file2db.ini in the folder where file2db is located.
You can create this file to store options such database connection.

Opton –d supress loading intialization file.

Example 1

Load each line from the customer.txt CSV text file to the customer table:

Using file2db you can customize view of some application downloaded from the commandus
software development group web site.
It is recommended make a backup copy of the database before changes are made.

To see list of commands an available options, execute file2db without parameters: