Go Premium for a chance to win a PS4. Enter to Win


Need BASH scriptable method to import DBFs into PGSQL on Linux

Posted on 2004-10-21
Medium Priority
Last Modified: 2012-06-27
I need to import DBFs into a Linux-based PostGRES database. I'm looking for a simple command line utility or script that I can incorporate into my bash scripts that run right on the server. I'm not looking for a commercial package or a GUI, just a simple command-line utility. I'd prefer NOT to use ODBC. I figure there must be a way to do this with XBase commands and tab files or something.
Any suggestions?
Question by:billmercer

Accepted Solution

rjkimble earned 328 total points
ID: 12372782
Mandrake, SuSE, and Debian all have a command, dbf2pg, in their respective "postgresql-contrib" packages that copies data from DBF files into a table of your choice. Run "dbf2pg --help" for details.

Alternatively, you can convert the DBF's into CSV files and then use the PostgreSQL COPY command to copy the file data into tables. You can generate your own script pretty easily.
LVL 22

Assisted Solution

by:earth man2
earth man2 earned 220 total points
ID: 12375484
dbf2pg can be found in postgresql source distribution in contrib/dbase directory
LVL 19

Author Comment

ID: 12375806
Excellent! Rjkimble, this is exactly the information I needed. And earthman2 read my mind and answered my followup question before I had a chance to ask it.
Thank you both!

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Best database to use for Maps is PostgreSQL. This is an open source database. Comes as a package with most Linux OS. For more info visit the following site: http://www.postgresql.org/ (http://www.postgresql.org/) This requires some add-o…
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question