This week's book giveaway is in the Android forum.
We're giving away four copies of Android Programming: The Big Nerd Ranch Guide and have Bill Phillips & Chris Stewart on-line!
See this thread for details.
Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jdbc applet works from command line but not on web page...  RSS feed

Greg Buron
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Im pretty new at java, and im trying to create an applet that connects to a database on a remote machine. So far, I have been able to connect to the database if i invoke the appletviewer from the command line like this:
C:\java>appletviewer protocols.html
where protocols.html looks like this:
<title>Protocol Database</title>
<APPLET CODE=JdbcApplet2 codebase="." archive="" width="400" height="175">

and JdbcApplet2 is the applet code that connects to the database. I found out that to envoke the applet from the command line, i had to have a file in the same directory called DbaApplPol.txt that has the following lines in it:
grant {
permission "developer", "resolve";
"", "connect,resolve";
grant {
permission java.lang.RuntimePermission
permission java.util.PropertyPermission
"file.encoding", "read";
to grant the applet permission to access the database. This combination of JdbcApplet2 code, DbaApplPol.tx, and invoking the applet from the command line works, and does exactly what it is supposed to do. however, when i load up the web page by itself (not from the command line, just double-click on the icon from my C:\java\protocols.html), the applet does not work. I believe it is because the applet when loaded in the web page cant utilize the DbaApplPol.txt permissions file. So if this is the case, how can I get the browser to recognize the permissions set up in the DbaApplPol.txt file? Or is there some other way people do this?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!