Skip to Content.
Sympa Menu

baslinux - Re: [BL] dbf to sql convertor, was Re: Spanish dollybase, was Re: DBF database package xdb-1.2.0 for glibc225

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: baslinux AT lists.ibiblio.org
  • To: baslinux AT lists.ibiblio.org
  • Subject: Re: [BL] dbf to sql convertor, was Re: Spanish dollybase, was Re: DBF database package xdb-1.2.0 for glibc225
  • Date: Thu, 10 Jul 2008 19:10:49 +0000 (UTC)

After trying twice to compile a linux dbf database manager, I compiled a
convertor from dbf to sql instead so I could use sqlite on my database.

http://keesan.freeshell.org/bl/dbf
for glibc225

sqlite filename.sql (the file generated by 'dbf' converting it from dbf
to sql) tells me:

Unable to open database "filename.sql": file is encrypted or is not a
database.

It is instructions for creating a file of that name and reading the file created by 'dbf' into it, containing info about field types and lengths, and also data. It worked on a sample file (see below) postamt.dbf.


sqlite postamt.db (makes the new file)
.read postamt.sql (makes field info and adds data)
.q (quits)

This correctly imported field descriptions and data.

The sql output of CDBF (for linux) is missing info about making the fields, and is also missing VALUES( for each record, which I think is needed to actually import each record. Also, the large database which I made with CDBF in DOS is full of syntax errors and will not import into sqlite, though the dbf file readable in another DOS DBF program from which I got the sample file below. sqlite seems to be fussier about its syntax than the old DOS programs.

Maybe the newer version of the dbf convertor will work better?

This sql file was created from postamt.dbf which is included in 'bsbrowse' free database manager by a Slovak programmer.

-- postamt.sql --
--
-- SQL code with the contents of dbf file postamt.dbf


drop table postamt;

CREATE TABLE postamt(
NAME varchar(20),
PLZ int,
STADT varchar(20)
);
INSERT INTO postamt VALUES(
'Schmidt ',445178,'Berlin ');
INSERT INTO postamt VALUES(
'Kohl ',445150,'Berlin ');
INSERT INTO postamt VALUES(
'Kluge ',302001,'Leipzig ');
INSERT INTO postamt VALUES(
'Schwartz ',372000,'Bienenfeld ');


Sindi





Archive powered by MHonArc 2.6.24.

Top of Page