can i import DBF files (i think it is files of paradox database) into H2 database?
I think a good solution is to write a small wrapper in java to read dbf data and save in h2 database, there is a jdbc driver to use paradox with java?
Thank you.
Paradox files are not DBF. These belong to dBASE. I think Paradox files have a .DB extension. In any case, whether the files you are working with belong to Paradox or dBASE, you can easily convert the data into a format H2 can import. Your solution would work.
I would go for converting the .DBF files to .SQL script (with CREATEs and INSERTs). It seems to pretty much software on the Internet which could help. I haven't used any of these, so I can't suggest a particular one.
Related
I am using Java in NetBeans to develop a program where i need to retrieve data from the few list of database file which is in 'dbf' format. I normally open the 'dbf' file with Microsoft Excel then import to Microsoft Access but this time i need all the process happen inside the code and will it possible to use query to get the data as well ?
IMHO the best way is to import DBF tables into SQL database (H2, SQLite, PostgreSQL) and do any queries you need. Check this library github.com/Yasas/xbase4j and/or contact me for examples.
I am attempting to write a java application that will unzip an archive and store it in a database.
I would like to insert each file in the database after it has been extracted, does anyone have a good example of a java unzip procedure?
A little google-search would have helped you. Tutorial by Sun.
If you want to store the extracted data in a MySQL-Database you'll want to use a BLOB to do so. Tutorial might be found here.
Notice: BLOBs should not grow bigger then 1M because they'll be slower then a normal file-system. Here is the full article.
I need to read .rpt files and load the data into MySQL or Oracle using Java.
Can anyone help in this?
As far as i know, .rpt files are used by BIRT.
Are the .rpt (report) files processed in any way or do you just have to write them into a database?
In case of the latter, the necessary steps are:
Create a list of all .rpt files
For each of the files:
Read the file into a String
CREATE a SQL INSERT statement and execute it against your database
Profit.
I will expand this answer if you clarify your requirements.
I am having a database in .dbf (FoxPro) format.
How to retrieve data from FoxPro using Java?
If the data can be migrated to MySQL, How to do the conversion?
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
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).
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?
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.
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.)
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/
I want to read text from excel file in J2SE using NetBeans. I found an article here about using Apache POI and JExcelApi, but I'd prefer not depending on external packages. if possible, using only Java built-in packages.
This almost worked, but it gives me an exception error:
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Do I need to install some ODBC driver (if so, which driver and how to install)?
What's the simplest way to solve this?
please help, thanks in advance
To summarize what was said already, accessing excel data from Java can be done via a two-step-process:
1) Set up the excel file as an ODBC data source.
2) Use the JDBC-ODBC bridge to access the excel data, using the standard JDBC api.
It sounds like you may have two problems:
1) The ODBC data source may not be set up, hence the "data source not found" error.
2) The jar for the JDBC-ODBC bridge driver may not be in your classpath, hence the "no driver specified". Google around for it. It's not hard to find.
You need to setup an ODBC driver that points to your Excel spreadsheet as a datasource. You can either create one using the Windows ODBC manager and reference it, or create it on the spot using the code here, at your same tutorial site.
I made a small application which read in an Excel sheet in to a JTable model very quickly. I think you should reconsider your usage of external libraries.
If you want to just read in the data, converting the XLS file to a CSV file format would be the best way.