Reputation: 21
How to import dbf file to mysql without using any paid tools ? or else using any stored procedure we can import the data from dbf file to MYSQL ?
Upvotes: 1
Views: 6952
Reputation: 121
Actually it is easy and possible. In case of Linux you should already have Open Office installed and you can download it from http://www.openoffice.org/download/index.html for free and install on you computer with Mac OS X or any Windows operating system.
Open Calc can simply open dbf
file and save as CSV.
You have to create a table with fields related to CSV and run some import procedure like described here MySQL LOAD DATA LOCAL INFILE only imports a single row
There are many challenges related to type of data, length of data, escaping some characters but those are beyond such short answer and would require insight into actual data. I prefer to transform CSV in editor to SQL INSERT command to avoid some pitfalls and limitations.
Upvotes: 2
Reputation: 2060
Get the description of dbf files (wotsit.org ...), write a small program interpreting the header of the dbf to write a fixed length record (really easy, because DBF files ARE - beside the header - fixed length records) or a comma delimited file and import this to any DB you want.
Upvotes: 0