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

Recommended Answers

All 2 Replies

Please post the full text of the error message.

@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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.