wood burning stoves
The moose likes Java in General and the fly likes Plotting DB data on Internet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Plotting DB data on Internet" Watch "Plotting DB data on Internet" New topic

Plotting DB data on Internet

Grant Crofton
Ranch Hand

Joined: Nov 08, 2000
Posts: 154
I have a project that I'm not sure how to approach, so I thought you guys might have some ideas.
OK, here goes...
I have to plot some data from an MS Access (and in the future, SQL Server) DB on the Internet. The data is simple sales numbers or similar, it just wants showing in bar charts or something.
The trouble is, I don't know the best (/easiest) way to do this.
I'd thought I could just have an applet that connects with JDBC to the data source and plots accordingly, but on reading the docs it seems that the JDBC-ODBC bridge is unsuitable cos you have to configure ODBC on the client, have a signed applet, and not all browsers support it.
We could buy a proper JDBC driver, but they seem quite expensive and we'd need a new one when the DB moved from Access to SQL Server.
I could pass all the data as <PARAM>s to the applet, but the page would need reloading when you wanted to view different data (eg. zoom in or scroll through it). This is possible with JavaScript and ASP or similar but it might be a bit messy.
Another way I was thinking of was to have a Java prog run on the server, drawing the image for the web page to load according to parameters passed from an ASP page or something. I don't think it would be hard to launch an app from an ASP page, but I'm not sure if the web page could be made to wait for the image to be drawn. Perhaps some JavaScript could do this. As the app is on the server, there wouldn't be a problem reding from the DB with JDBC-ODBC. Also the image would have to be saved as a GIF (or JPEG) - is this possible?
The last option would be to buy something that did this already, as an applet or ActiveX control. Anyone know of anything that would do the job?
OK, I think that's about it. Any thoughts?
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
The experience i had in this field was a project for develloping a web site for an invest bank. They wanted to show pipe graph representing shares of a client. We work with a servlet that retrieve the data from the database. Then the data was reformatted and a mpeg was created on a temporary directory. The url of this file was put in the http session and finally displayed by the Jsp on which the request was forwarded. This temporary directory was attach to the session and destroy when this died.
I was worrying about the creation of the mpeg file. But it's quite fast and the deletion of file works well using an unbindingEvent.

Benjamin l�onard
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

If you're going with servets then the content type you return can be the mpeg (or image or whatever) itself rather than doing the 'temp file' thing.
If you head over to the Servlet/JSP forum there'll be more info.
There are jave packages out there to create GIF and JPEG images as well
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
sorry you are right but i forget to say that the library i use to create the charts was only able to create a file. So i was oblige to do it like this. But i suppose there are other libraries that are doing the job better!
Benjamin l�onard
I agree. Here's the link: http://aspose.com/file-tools
subject: Plotting DB data on Internet
It's not a secret anymore!