0

i wanna ask another thing i have created an applet which has one main file and 7 other class files now i want to connect it to database the following code is in class file on compiling it gives access control exception...

private boolean spellCheck(String spell)
{
Connection Conn;
Statement Stat;
ResultSet Rs;
String match;
Boolean retCode;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbc");
Conn = DriverManager.getConnection("jdbc:odbc:Vocabulary");
Stat = Conn.createStatement();
String que = "Select * From Scrabble WHERE id = "+ spell;
Rs = Stat.executeQuery(que);
match = Rs.getString(1);
if(match != null)
retCode=true;
}
catch(SQLException e)
{}
catch(ClassNotFoundException cnfe)
{}
return retCode;
}

i have edit the policy file with this code

grant
{
permission java.lang.RuntimePermission
"accessClassInPackage.sun.jdbc.odbc";
};

grant 
{
permission java.lang.RuntimePermission
"accessClassInPackage.sun.jdbc.odbc";
permission java.util.PropertyPermission
"file.encoding", "read";
};

bt still its not working and gives same access control exception

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by peter_budo
0

@NormR1 that is unlikely to happen as that fool omitted any reporting in catch statements.

Shaaani, put printStackTrace() in your your catch blocks then you would know what is wrong

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.