Can anyone give me some idea about uploading data from excel to access database using java
You'll definitely want to check out Apache POI - Java API To Access Microsoft Format Files. You'll likely find the Excel bindings you need there. For MS Access, you'll want a JDBC Driver which you can find on Sun's website. Then you can just write the glue code.
Why would you want to use Java for that? You can link Excel and Access data directly:
http://office.microsoft.com/en-us/access/HP010950951033.aspx
I've used POI before to read and write Excel files. Once you got the data, use JDBC (maybe the JDBC/ODBC bridge) to load it into Access.
Related
I am generating a metaquery created with the PowerQuery syntax, and I would like to use some library to generate an excel file from there.
I have tried POI and Docx4j with no success. Any advice would be helpfull.
Thanks in advance.
I'm not aware of any Java libraries that can add Power Query queries to an Excel file. The structure inside of the Excel file is documented here, so you could implement yourself, or request a library developer to implement it.
You can use VBA to automate creating queries in Excel 2016 https://gallery.technet.microsoft.com/office/VBA-to-automate-Power-956a52d1
Maybe you could use java to send a message to some VBA running in the Excel workbook, or to generate some VBA script that runs when you open the workbook, and have the VBA actually create the query?
Edu says: store the query in the windows clipboard and then generate the query via VBA in excel with a macro.
I have an Excel with some macros. The data is currently sourced manually. In order to automate the report, I need to source the data directly from Oracle database. Unfortunately, this cannot be done, as it is a production database and passwords cannot be shared with anyone.
The next best possible approach is to connect via the Java layer. How can I connect VBA with a Java service?
Any conceptual starting points will also be appreciated.
There is a very nice API from Apache called POI for processing Microsoft documents. http://poi.apache.org/
The other approach is to use OLEDB driver for Excel which will allow you to read data from Excel exactly as you will do from any database using JDBC.
Interop between different technologies likes this is commonly achieved with a combination http and xml.
It's a long time since I saw this done so the technologies might be out of date but you can create a ADO record set from XML.
Excel can make a http call to a Java server that returns the xml. This xml can then be used to create a record set for Excel to consume just as if that record set were obtained directly from the database.
I am looking for the possibility of creating an excel file from a query that a user may generate on our database, so that the user can download it.
Currently we have results displaying to the GUI, but I am wondering what is the best way to create the excel file with the data returned. I'm using a MySQL DB, java JAxRS, JavaScript & html5.
Any suggestions are very welcome.
As javadev mentioned, Apache POI is one of the best approach I would also suggest. Here is an example code that suits your requirement. Hope this would help.
I highly recommand to use Apache POI API
Here is a good tutorial to start.
I've .txt files generated by Java (with databases queries). I need to generate an excel with that (with graphics and other kind of information, is not just a pure csv).
How can I call my excel macro using java?
I would say, have your Excel macro use the csv as a data source and let it do it's job directly.
Otherwise you might want to look into a reporting framework like jasper reports http://community.jaspersoft.com/project/jasperreports-library
You need to use a JAVA-to-COM bridge, such as Jacob. http://danadler.com/jacob/ there are other out there but I am familiar with Jacob. Then you would be able to start the application, load the file, run the macro, and then close the application. This should get you started.
Why not create an excel directly using java apache poi, instead of creating txt and then converting txt excel using macro.
I extracted data from excel using poi api. Now I want to store the data in access please clarify
To the point, you just want to "convert" Excel to MSAccess using Java code? Here are the steps:
1) Extract data from Excel into Java objects (List, String, Number, Javabean, etc).
2) Insert the data in flavor of those Java objects into MSAccess.
That's basically all. For 1) you can use under each the Apache POI as you already found out. For 2) you can use the JDBC. I think your problem is more that you don't understand what JDBC is and how to work with it. In that case you may find the Sun's JDBC tutorial useful. Good luck.
You need something like JetProxy -- a JDBC driver interfacing to Jet (the internal name of Microsoft Access's own quasi-relational sort-of-SQL DB engine). There are other products much in the same vein, but I have no personal experience to help suggest which product is best for your purposes -- just try a few!-)
You can either use the commercial JDBC drivers by HXTT or the JDBC-ODBC bridge by Sun