有关applet连接SQL数据库出现异常的问题,急!

Feilongyizu 2004-04-20 08:49:52
在applet程序中,我用jdbc-odbc桥连接数据库,部分程序如下:
class Listener implements ActionListener {
ResultSet result;
public void actionPerformed(ActionEvent e) {
Object obj=e.getSource();
if(obj==buttonAccept) { //if1
String id=textID.getText();
if(id.length()==0) { //if2
JOptionPane.showMessageDialog(null,"the user name cannot be empty!");
return;
}//end of if2
else { //else2
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con;
con=DriverManager.getConnection("jdbc:odbc:HRsystem","sa","1");
PreparedStatement stat=con.prepareStatement("select * from ClientData where cID=? and cPassword=?");

stat.setString(1,textID.getText());
stat.setString(2,passwd.getText());
result=stat.executeQuery();
while(result.next()) {
System.out.println(result.getString(2));
}//end of while
}//end of try
catch(Exception exception) {
System.out.println("Could not execute the query: "+exception);
}//end of catch
}//end of else2
}//end of if1

结果在调试时按下button后,报出如下异常:
Could not execute the query: java.security.AccessControlException:access denied (java.long.RuntimePermissiton accessClassInPackage.sun.jdbc.odbc)

不知怎样解决.请指点.
...全文
56 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
dovi 2004-04-23
  • 打赏
  • 举报
回复
applet权限是受到限制的,做成Application试试
hhubon 2004-04-22
  • 打赏
  • 举报
回复
在policytool里配置策略
iwillsw 2004-04-20
  • 打赏
  • 举报
回复
没有权限,给applet加上数字签名

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧