Importing DBF files into a MySQL database
I recently needed to import a large number of DBF files into a MySQL database. These DBF files may end up providing a large set of test data for spotstory.
After searching far and wide and encountering many stale and broken links, I came across a version of dbf2mysql published by Josh Drew.. I had a great deal of success with this program.
I ran into one hiccup with dbf2mysql; errors were not reported if the DBF file contained a column name which conflicted with a MySQL keyword. This is resolved by changing the calls to mysql_query as follows:
if (mysql_query(SQLsock, query) != 0) { /* error handling */ }
Previously, only return values of -1 were identified as errors. According to the MySQL documentation for mysql_query, all non-zero returns indicate an error.
Hopefully, Josh will incoorporate this improvement into his version of dbf2mysql. It truly saved me hours of time!
No comments yet. Be the first.
Leave a reply

