Re: DBF into Informix
Posted in 1997
cltucker@mindspring.com (Chris L. Tucker) wrote:
:This is probably a newby question, for I am a newby at databases,
:but I did hunt for an faq and I did hunt through mountains of printed
:and online docs, and so I plead and post and hope for clue.....
:
:I'm trying to import a .dbf file into an Informix database. I
:feel like the answer is staring me in the face somewhere, but
:without writing some ugly perl scripts I can't seem to get it
:into the database appropriately. I'm running Informix 7.12 on
:and SGI, btw. Also, none of the .pdf manuals (phew!) had docs
:on the dbimport command syntax, although it sounds promising as
:a likely candidate to help.
You will want to use either the dbload utility or use dbaccess and
execute the command:
load from 'filename' insert into tablenameThe load command assumes you have a table with exactly the same
columns as in the file you load from, while the dbload utility have
ways to load into tables that are not exactly like your file.
Using the load command above your file will have to contain every
column as ascii data (or in whatever characterset you are using) with
a single character delimiter between each field. The default delimiter
is | (vertical bar). If there is a delimiter character as part of your
data you can escape it with \\ (backslash). Use \\\\ (doulbe backslash)
to get a single one into your data.
dbload also understand this same format, but can also be used on fixed
with column data (no delimters between columns are needed).
As far as I can remember a .dbf file (from an xBase product isn't it?)
contains binary data. You will in that case have to convert it to
characters only (ascii or whatever). Normal conversion with xBase
products gives you comma delimited files, but with quotes arround
character columns. It's unfortunate that Informix can't directly load
this very much used format, but it's simple enough to convert it to a
single delimiter character using Unix tools. If you should have
problems with that then post a small part of your import file and
someone will help you.
You should have a separate manual describing the dbload utility.
:If someone could outline the steps or point me toward a reference
:that really has the answer, I'd appreciate it immensely and I'll
:be on comp.unix.solaris for the next time you have a sys admin
:question!! Thanks in advance,
Nils.Myklebust@idg.no
NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway
My opinions are those of my company
The Informix FAQ is at http://www.iiug.org