views:

354

answers:

6

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?
+1  A: 

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.)

Hans Westerbeek
+1  A: 

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.

harigm
will you please tell me to how to convert Foxpro data as CSV format ?
Paul
A: 

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/

Paul
+3  A: 

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

Rick Schummer
+1  A: 

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).

A. Ionescu