Tuesday, June 23, 2009

DBF to MySQL Data Conversion on Windows Hands-Free

I spent several weeks looking for an easy way to import data from DBF files (the application was written in FoxPro for DOS some time around 1993) into MySQL on a regular basis. First, I looked for a utility to perform one-step conversion (DBF to MySQL). No luck there (not that I didn't find any, just none of them worked).

Then, I figured, I could convert DBF files to CSV files first and then import them into MySQL using LOAD DATA INFILE, but the question was how to do the DBF-to-CSV part. OpenOffice Calc and MS Excel were out of the question (converting 30 tables every night manually wasn't something I was eager to do; besides, many of them exceed the limit of 65536 rows), so I had to look for other options, preferably something that can run unattended at night while I am at home sleeping.