Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet + Database

 
Christopher Arthur
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Christopher Arthur
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic