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 Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Many developers have database experience, but are new to PostgreSQL. It has some truly inspiring capabilities. I have several years' experience with Microsoft's SQL Server. When I began working with MySQL, I wanted a quick-reference to MySQL (htt…
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.
Watch the video to learn how one can deal with PST file corruption issue with an outstanding Kernel for Outlook PST Repair Tool easily. Using this tool, non-technical users can swiftly perform the repair process to restore their essential data witho…
Suggested Courses
Course of the Month3 days, 19 hours left to enroll

599 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