logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

dbf2mysql, mysql2dbf - convert between xBase and MySQL databases

Authors

       Originally written by Maarten Boekhold <boekhold@cindy.et.tudelft.nl>, Oct 1995.

       Patched for MySQL by Michael Widenius <monty@analytikerna.se>, 3 Nov 1996.

       Manual page written for Debian GNU/Linux from README by  Heiko  Schlittermann  <heiko@lotte.sax.de>,  Aug
       1997;  updated  by  Matej  Vela  <vela@debian.org>,  Nov 2001. New options available added by Francesco P
       Lovergine <frankie@debian.org>, Dec 2020.

Bugs

mysql2dbf can't write MEMO files at this time.

       Possibly incorrect field lengths for REAL numbers.

Description

dbf2mysql takes an xBase file and sends queries to an MySQL server to insert it into an MySQL table.

       mysql2dbf dumps a MySQL table to a dbf file.

Disclaimer

       The authors do not accept any responsibility for possible damage you get as result of using this program.

Debian Project                                     2020-12-29                                       DBF2MYSQL(1)

Name

       dbf2mysql, mysql2dbf - convert between xBase and MySQL databases

Options

-v     Produce some status output.

       -vv    More verbose.

       -vvv   Even more verbose: produce a progress report.

       -f     Translate all field names in the xBase file to lowercase.

       -u     Translate all text in the xBase file to uppercase.

       -l     Translate all text in the xBase file to lowercase.

       -L     Use LOCAL INFILE for table loading in MySQL.

       -n     Allow NULL fields: 'NOT NULL' will be not added in table creation statement.

       -ofield[,field[,...]]
              List fields to insert into MySQL database.  Primary use is to ease import  of  complex  dbf  files
              where we want only few fields.  NOTE: -o is processed before substitution (-s), so you have to use
              dbf field names here.

       -econversion-file
              Specify  file  for  CHAR  fields  conversion.   File  format is: 1st line: number of characters to
              convert (number of lines).  Further lines: <char_to_convert> <char_after_conversion>.

       -sold-name=new-name[,old-name=new-name[,...]]
              Takes a list of field name/new field name pairs.  Primary use is to avoid conflicts between  field
              names and MySQL reserved keywords.  When the new field name is empty, the field is skipped in both
              the  CREATE  clause  and  the INSERT clauses, i.e. it will not be present in the MySQL table.  For
              example:

              -s ORDER=HORDER,REMARKS=,STAT1=STATUS1

       -ifield[,field[,...]]
              List fields to be indexed.  MySQL field names should be used here.

       -ddatabase
              Select the database to insert into.  Default is 'test'.

       -ttable
              Select the table to insert into.  Default is 'test'.

       -c[c]  Create table if one doesn't exist already.  If the table already exists, drop it and build  a  new
              one.   The  default  is  to insert all data into the named table.  If -cc is specified, no records
              will be inserted.

       -pprimary
              Select the primary key.  You have to give the exact field name.

       -hhost
              Select the host to insert into.  Untested.

       -F     Fixed length records.  (By default CHAR is saved as VARCHAR.)

       -qdbf2mysql: "Quick" mode.   Inserts  data  via  temporary  file  using  'LOAD  DATA  INFILE'  MySQL
              statement.   This  increased  insertion  speed  on my PC 2-2.5 times.  Also note that during whole
              'LOAD DATA' affected table is locked.

              mysql2dbf: Specify custom query to use.

       -r     Trim trailing and leading whitespace from CHAR type fields data.

       -x     Start each table with _rec and _timestamp fields.

       -Ccharset
              Specify the charset to use in table.

       -Ppassword
              Specify password on the MySQL server.

       -Uuser
              Specify user on the MySQL server.

Synopsis

dbf2mysql  [-v[v]]  [-f]  [-u|-l|-L]  [-n]  [-ofield[,field]]  [-econversion-file]  [-sold-name=new-name[,old-name=new-name]] [-ifield[,field]] [-ddatabase] [-ttable] [-c[c]] [-pprimary] [-hhost] [-F]
       [-q] [-r] [-x] [-Ccharset] [-Ppassword] [-Uuser] dbf-filemysql2dbf [-v[v]] [-u|-l] -ddatabase-ttable [-hhost] [-qquery] [-Ppassword] [-Uuser] dbf-file

See Also