• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

accessing database from a applet-changing policytool

 
Sam Pereira
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a site which is run on localhost.

Although the applet connects to a access database when it is not inside the web page it doesn't get connected to the database while on localhost.I read the answer in webpage
and with the link
I tried to change the policy tool.Since I don't know much about policy tool I am finding it difficult to follow the instructions.
First of all I have java in `Program Files` and `Program Files(*86)`.
In


C:\Program Files\Java\jdk1.7.0_45\jre\lib\security

I changed the java.policy by adding


But the problem is, as mentioned in the article though I went to `C:\Program Files\Java\jre7\lib` it doesn't have a `security ` folder.

So I then tried program files (*86).In it I went to `C:\Program Files (x86)\Java\jre7\lib\security` and changed the policy tool as







I don't know whether to include that code or this

In program files (*86) I don't have the path mentioned in the article

`J:\Program Files\java\jdk1.8.0_25\ \jre\lib\security` as there's no jdk file in it.

Can't this policytool be done by in cmd->policytool->add policy entry->add permission->all permission->save as->jdk1.7.0_51\jre\lib\security\java.policy

Even this doesn't work.Can someone please tell me how I can set the policytool
 
Paul Clapham
Sheriff
Posts: 21583
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of banging your head against applet security, why don't you just write an ordinary Java application? Then you don't have any security issues at all. Is there some reason you have to have it in a web page? Since it's expecting to connect to an Access database on the client's system I can't imagine you're going to have a lot of different people using it.
 
Sam Pereira
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am learning applets and this is what was asked to do.So have to include a applet
 
Paul Clapham
Sheriff
Posts: 21583
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry about that -- I haven't ever had to mess about with the java.policy file. For all I know the recent changes that Oracle made to improve applet security might have prevented that file from being used any more; they probably wouldn't bother to mention that because there's almost no practical use for the java.policy file in real life. In fact it's just another way for malware to subvert applet security.

But I don't know that for sure. What I do know is that learning about the java.policy file for applets is pretty much a waste of your time. So I'd suggest you shortcut the process and go to your teacher and ask them to show you how it's done. (Don't mention the waste of time issue, that isn't going to help.)
 
Sam Pereira
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if it would work Thanks for the help
 
Mauro Trevigno
Ranch Hand
Posts: 99
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you receive an error message?
If yes, which error message?

How are you reading from your java program the policy file?

I recommend you to save some data over a .txt and when this works do the changes to the database.

You can check policytool tutorial:
PolicyTool

For test purpouses you can set the following on the policy file:
permission java.util.PropertyPermission "*", "read, write";

Let me know how it goes.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic