0

I have a Java Applet which displays 2D table data from a Derby database. I am also using Netbeans. I want this application on a webpage. I have uploaded the html document and all the .class files into the proper directory on the server. What remains is accessing the database.

I would like to use Embedded Derby so that my application contains the database (is my understanding of that fact correct?). Then I should be able to upload the html and jar/class files to the server and my application will be deployed. However I am confused on the following:

  1. How do I create/setup the database to live on the webpage?
  2. What would my connection string be?
  3. Is there a better way to do this altogether in NetBeans?

All help is greatly appreciated. Let me know if I can make my question clearer.

CodeKingPlusPlus
  • 15,383
  • 51
  • 135
  • 216
  • The database connection functionality must be complied into the applet. There isn't a way to do this in plain HTML. You will need access to the applet's source code. – Oliver Spryn Nov 22 '12 at 01:49
  • Look at my revision. I posted my source code that connects to my database. I guess the problem is my database is local. – CodeKingPlusPlus Nov 22 '12 at 02:14
  • There are technologies out there that will perform this task far better than what you're suggesting. For example, you could render a the data on the server in an html page and serve it up. If the data is dynamic, you could update it with Javascript. – BillRobertson42 Nov 22 '12 at 06:47

1 Answers1

0

You can package your Derby database itself inside a JAR file as part of your applet, and then it will be effectively part of your applet and downloaded when your applet is downloaded.

See this related question: Distribute a database made with JavaDB with Java program

Note that this will create a read-only database. If you actually need to update your database from your applet, you'll need a more sophisticated approach (e.g., package the initial data into the applet, then when the applet starts up, request access to local storage on the workstation and create the writeable database there).

For complete documentation on building and deploying a database-in-a-jar, the documentation is here: http://db.apache.org/derby/docs/10.9/devguide/cdevdeploy15325.html

Community
  • 1
  • 1
Bryan Pendleton
  • 16,128
  • 3
  • 32
  • 56