aspose file tools*
The moose likes JDBC and the fly likes Applet Access denied Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Applet Access denied" Watch "Applet Access denied" New topic
Author

Applet Access denied

b rao
Greenhorn

Joined: Sep 03, 2000
Posts: 7
Dear friends,
I tried with this programme but could not establish connection and output.
Could enyone exaplain why it happens?How to rectify the problem?
The details of my programme is given here.
//in ms access db name is jdbcdemo2
//file is notebook with fields and data

import java.applet.*;
import java.sql.*;
import java.awt.*;
public class SelectAppletDemo extends Applet
{

ResultSet rs;
public void init()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc dbc:jdbcdemo2","","");
Statement stmt=con.createStatement();
rs=stmt.executeQuery("Select * from notebook");
}
catch(Exception e)
{
e.printStackTrace();
}
}
public void paint(Graphics g)
{
int i=10;

try
{
while(rs.next())
{
g.drawString( rs.getInt("itemno") +" " + rs.getInt("itemnos") +" "+ rs.getString("itemsize"), 20,i);
i+=20;
}
}

catch(Exception e)
{
e.printStackTrace();
}
}

}
------------------------------------------------------------
compiles but generates runtime exceptions as follows.
java.security.AccesControlException:access denied.....
and
java.lang.NullPointerException....

Thanks in advance.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
hai,
Did you try by changing the policy file (permissions)?
if not first run the policy tool and add the permission to your directory

regards
san
b rao
Greenhorn

Joined: Sep 03, 2000
Posts: 7
Hi San,
I could not understand.
what is the Policy file or Policy Tool?
Let me know them.
You can through a little light on them.
with regards
rao
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
hi
Whenever you use the applets it first checks the policyfile(which contains the which permissions are given to which users) if your directory is not set to use the database files then it may give error. so to grant the permission you have to run policytool then click add and give the path of your directory and the permissions you are allowing after that run your prg if also not working then let me know what u did.
regards
sandhya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applet Access denied