Paul
Paul

Reputation: 1390

How to migrate data from FoxPro to MySQL

I am having a database in .dbf (FoxPro) format.

  1. How to retrieve data from FoxPro using Java?
  2. If the data can be migrated to MySQL, How to do the conversion?

Upvotes: 4

Views: 15398

Answers (6)

Zoot
Zoot

Reputation: 2235

Do you have a copy of FoxPro? You can save the database as an HTML file, if you want. Then, from HTML, you can save to any format you want. I recently did this to save a FoxPro table as an Excel spreadsheet (not that I'd suggest using that for your Java code). If you plan on using Java, once you have access to the data, why not use one of Java's native storage types?

Upvotes: 2

A. Ionescu
A. Ionescu

Reputation: 2146

You can use XBaseJ to access (and even modify write) data from FoxPro databases directly from Java with simple API.

This would allow you to have the two applications (the old FoxPro and the new Java one) side by side by constantly synchronizing the data until the new application is ready to replace the old one (e.g. many times the customers still hang on and trust more their old application for a while).

Upvotes: 3

Rick Schummer
Rick Schummer

Reputation: 1067

Taking the data to intermediate formats seems flawed as there are limitation with memo fields and CSV or Excel files.

If you are interested in a more direct approach you could consider something like "VFP2MySQL Data Upload program" or "Stru2MySQL_2", both written by Visual FoxPro developers. Search for them on this download page:

http://leafe.com/dls/vfp

DB-Convert (http://dbconvert.com/convert-foxpro-to-mysql-sync.php) is a commercial product that you might find helpful.

Rick Schummer, VFP MVP

Upvotes: 5

Paul
Paul

Reputation: 1390

Two steps: DBF => CSV and the CSV => MySQL.

To convert DBF(Foxpro tables) to CSV the below link helps a lot

http://1stopit.blogspot.com/2009/06/dbf-to-mysql-conversion-on-windows.html

CSV => MySQL MySQL itself supports CSV import option (or) to read csv file this link helps http://www.csvreader.com/java_csv.php I read the CSV file using Java CsvReader and inserted the records through program. For that i used PreparedSatement with Batch the below link gives samples for that http://www.codeweblog.com/switch-to-jdbc-oracle-many-data-insert/

Upvotes: 1

Hans Westerbeek
Hans Westerbeek

Reputation: 5805

I suppose doing a CSV export of your FoxPro data and then writing a little Java programme that takes the CSV as input is your best bet. Writing a programme that both connects to FoxPro and MySQL in Java is needlessly complicated, you are doing a one time migration.

By the way PHP could do an excellent job at inserting the data into MySQL too. The main thing is that you get your data in the MySQL schema, so you can use it with your new application (which I assume is in Java.)

Upvotes: 1

gmhk
gmhk

Reputation: 15940

I worked on the same project once long back where the project had be done with FoxPro and then we migrated that project to Java with MySQL.

We had the data in Excel sheets or .txt files, so we created tables as exact replica of the FoxPro data and transferred the data from the Excel/CSV /txt to MySQL using the Import data feature.

Once we did this, I think further you can take care from MySQL Data.

But remember work will take some time, and we need to be patient.

Upvotes: 1

Related Questions