I m working on a web application where user can store a file and if they want they can replace the old file with a new one. I m using Java for backend, Angular 4 for frontend and oracle db. Can i store the file as it is in oracle db in the table or I should use something else. Thank you
Referring to the official oracle doc you can use a BLOB type.
Maybe a better solution is that you can save the file locally and put only the path to the database.
Link to the oracle doc
I have to create a library that will be used by others to import data from an excel sheet into a database.
The user will only give the name of excel file and the database connection.
The library has to build a create table script and insert the data. The name of the table can be the same as the excel file name.
What is the best solution in java? Is there an api that does this?
Thanks.
Below is what will do in this sense.
First, read and parse the excel data. jxl or poi library can do this.
If we can't read or parse excel, break flow
When parsed successfully, create the corresponding table by using the jdbc api or something like that. The table structure based on the excel sheet columns.
Then batch insert the parsed excel data into database.
Looking for help to import excel sheet data to java frame table or directly import to mysql database using java application
To directly import the data into MySQL database, the following thread already discussed that into details : How to import an excel file in to a MySQL database
Mysql also provides an add-in tools (Excel for Mysql) for Microsoft Excel that enables you to open MySQL database within Excel and export the data. More reference about this can be found at https://blogs.oracle.com/MySqlOnWindows/entry/how_to_guide_to_exporting and https://www.mysql.com/why-mysql/windows/excel/
Also, you can use MySQL "LOAD DATA" command. You can read more about that online
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.
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/