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.
Related
I have an Excel workbook with multiple sheets. Each sheet holds a table, the different tables have different formats.
I need to read the entire workbook into my Java program. The most convenient method IMHO is to export the entire data into a single XML and parse it (using simpleXML or some other compatible parser).
I have found no method for applying a schema to multiple sheets of a workbook, only to a single sheet. Is it possible? If so, how?
When it comes to convenience, there are many factors that influence or define it. For example, it depends if this is an ongoing thing, or if it needs to be integrated into a process, etc.
Before recommending a solution as suggested, I would try to convince you to take a look at Apache's POI (the Java API for Microsoft Documents), specifically the Excel API. It gives you a Java API for your Java program that should allow you to read what you need pretty easily. It would be a one stop shop kind of thing.
Another approach might be to use Jdbc to Odbc and access the Excel via JDBC API (JDBC to ODBC provider). I can't tell from details in your question if your deployment model would allow for this (e.g. if you run on a platform that doesn't have an ODBC provider for Excel files), but on Windows for sure is an option; also, many places on internet detailing this approach.
If you insist on going down the XML export way, QTAssistant (I am associated with it) has a comprehensive solution (XML Builder) for generating XML from any supported relational data source. It provides a GUI and a command line. In your case it would need the XLS, an XSD which describes the XML you want to get out and a mapping file (basically another XML file) to create the XML you need. In general this feature is largely used to convert test data into XML for Web service calls, so it is geared towards a certain interaction pattern between the user, the tool, and the XML generation activities. If you're interested in more details, let me know.
I have a standalone Java application capable of replaying a time series of data records. Communication with the server is performed using a bespoke binary wire protocol over TCP/IP.
We have a requirement to be able to easily import data records from this application into MS Excel / Access and I am interested in the recommended way to do this.
One idea we're exploring is to write a web "wrapper" service (also in Java) that will communicate with the underlying server and then translate the binary data into a more friendly text format for consumption by Excel / Access. However, the drawback here is that we lose any type information associated with each field in a given record.
I've briefly looked into writing custom ODBC / OleDB drivers but this seems complex and is probably overkill for what we're trying to achieve.
Can anyone recommend any other approaches?
How about xlloop? http://xlloop.sourceforge.net/
Uses an Excel plugin to connect to a function server, where you can create your own functions.
You may connect with an Access Database via the JDBC/ODBC Bridge driver.
From your previous comments I assume that you need to serve dynamic/changing data. If that is the case then take maybe the IRtdServer interface and this article referring to Excel. Its a COM Interface so you probably will need something like Com4j
I was wondering if an API exist that would allow me to dump a synergy database through java. I can create an excel report through IBM Rational Change but it would be nice if there was a way to just send a CCMDB query to the server through java and generate a CSV or XML file and have it dumped locally. Any body know of a possible way to do that?
I would doubt that something exists publicly. You can always call a command line ccm query from java and parse the output. I am working on a Python script that will do something similar, but it will be highly specific to my project DB setup (which is a mess).
We have an application (Java) with an own OR mapper. Within this system we have what can be compared to Hibernate's interceptors (we call it triggers): Do specific actions just before saving data in the database, after it's deleted and so on. The underlying database is MySQL.
Now we would like to use tools such as Pentaho Data Integration or Talend to convert data to put it into our system. It's no problem to do that directly on the SQL level, but by doing so we loose the built-in power of our triggers.
Is there a way to somehow integrate any of the Data Integration solutions into our existing application? It would be great if there was a way to write into instances of our classes instead of writing into the database directly.
Any hints welcome :-)
I'd prefer Talend which is a Java code generator tool. (You can se my blog post at http://www.robertomarchetto.com/www/talend_studio_vs_kettle_pentao_pdi_comparison)
You could use a tJavaRow so you can write Java code for each processed row. In tJavaRow you can call Hibernate code, for example using a custom class defined in a new routine.
2 ways with Pentaho data integration I can think of straight off:
Simply create a plugin which adds/deletes data - you could copy the existing salesforce insert/update plugins, they would be a good start - rip out all the salesforce code and replace with yours.
Perhaps harder; But maybe more satisfying - Write a jdbc driver which uses your code!
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.