AccessControlException and java.policy

Wigzell, Cathy (cathy.wigzell@inteq.com)
Fri, 6 Aug 1999 08:25:00 -0500

From: "Wigzell, Cathy" <cathy.wigzell@inteq.com>
To: "'java-security@java.sun.com'" <java-security@java.sun.com>
Subject: AccessControlException and java.policy
Date: Fri, 6 Aug 1999 08:25:00 -0500

Hi,

I am having problems accessing a SQLServer database from an applet.

The database lives on the same machine as the web server and I am loading
the applet from this server on to a client machine using IE4. I have
installed the Java plug-in 1.2.2 on the client to enable various Swing
components in the applet. The plug-in also gives me a console so I can see
what's going on. JDK is not installed on the server.

When the applet tries to load the jdbc-odbc bridge driver I get an
AccessControlException: access denied (java.lang.RuntimePermission
accessClassInPackage.sun.jdbc.odbc)

There is a similar query already in the security archive and the response
was to add the following into the java.policy:

grant codeBase "<codebase for your program>" {
permission java.lang.RuntimePermission "accessClassInPackage.sun.jdbc.odbc";
}

I presume this should be added to the client's java.policy, but in the real
world this will have to be done by my applet. Can the applet amend the
policy directly and, if so, how?

Many thanks,
Cathy Wigzell