Meaningless Drivel is fun!*
The moose likes Applets and the fly likes Applet + Database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet + Database" Watch "Applet + Database" New topic
Author

Applet + Database

Christopher Arthur
Ranch Hand

Joined: Mar 09, 2004
Posts: 149
Hi,

I'm writing a program that could be good as an applet except for one problem. The problem is that the program needs to read data from a large (6-10 MByte) file. The data file can't be broken up, either. The ideal solution is to keep the data file on the web host and use a servlet-applet design, so that the applet can get only the little parts it needs from the file by telling the servlet what to get. The problem is that I was wanting to put this on my university web page, which doesn't support servlets or JSP's--they told me "no active content", but I'm wondering if maybe there is some clever way around this, aside from expecting the users to download the datafiles to their machines every time that they want to run the applet (since there are about a dozen 10 mb files, this would be crazy).
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41906
    
  63
If you don't want the user to download the file, let the applet do it. As long as the file is on the same server as the applet, it can get at it through HTTP (or the classloader/resource mechanism).
I don't think you can avoid downloading the complete file, though.


Ping & DNS - my free Android networking tools app
Christopher Arthur
Ranch Hand

Joined: Mar 09, 2004
Posts: 149
Could I set it up some way so that once the user downloads the file, if they revisit the web page, they won't have to redownload the database? It's been a while since I coded an applet, so I can't remember what the security limitations are. Is it so that the less technical but trusting users could be prompted for allowing privleges, or is it something that has to be set by an administrator or in the browser?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41906
    
  63
If the DB contents don't change, the users could just be told to keep the file on their machine, couldn't they? And yes, the applet needs to be signed if it wants to read the file off the local file system. Details on how to handle that are on this wiki page.
 
Consider Paul's rocket mass heater.
 
subject: Applet + Database