How Do I add a permission file to an applet?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Pav_Gill
Posted On:   Monday, July 16, 2001 02:03 AM

I'm trying to connect to a database using a JDBC-ODBC connection. I have set up a permission file, as described on the sun site. However I can't get my applet to recognise this file when I start it. Is there something I need to add to the HTML file or to the java code in the applet itself in order for this permission file to be recognised to I stop getting the following error:

java.security.AccessControlException: access denied
(java.lang.RuntimePermission
accessClassInPackage.sun.jdbc.odbc )

Thanks in advance for any help.

Re: How Do I add a permission file to an applet?

Posted By:   Pav_Gill  
Posted On:   Monday, July 16, 2001 10:39 AM

Once again I seem to have answered my own query, however I've come up with another one.

I managed to alter my java.policy file and add in the required permissions as follows:
permission java.lang.RuntimePermission  "accessClassInPackage.sun.jdbc.odbc";

permission java.util.PropertyPermission "file.encoding", "read";



My applet now runs as the JVM can access the required JDBC-ODBC driver, and the database can be accessed.

However this would mean that I need to change the java.policy file on every single machine I wanted my applet to run on.

There must be an easier way, I wonder if anyone out there knows of it? Is there some code I can add to my applet which needs to use the driver to read a permissions file, or hard code the permissions into the java code of the applet itself??

Any help appreciated.
About | Sitemap | Contact