Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet Access denied

 
b rao
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic