当前位置: 技术问答>java相关
java.security.AccessControlException: access denied (感谢大虾帮忙!)
来源: 互联网 发布时间:2015-01-07
本文导语: *db1.java* import java.util.*; import java.sql.*; import java.applet.*; import java.awt.*; import java.awt.event.*; public class db1 extends Applet implements ItemListener { CardLayout clt=new CardLayout(); int a[]=new int[40]; int r=0,n=0; Panel pp=n...
*db1.java*
import java.util.*;
import java.sql.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class db1 extends Applet implements ItemListener
{ CardLayout clt=new CardLayout();
int a[]=new int[40];
int r=0,n=0;
Panel pp=new Panel();
Panel p[]=new Panel[40];
String array1[]=new String[40];
Label l[]=new Label[40];
Panel p1=new Panel();
Label l1=new Label("分数");
int array3[]=new int[40];
TextField t1=new TextField();
CheckboxGroup ck[]=new CheckboxGroup[40];
Checkbox cx[]=new Checkbox[200];
String array2[]=new String[200];
public void init()
{System.out.println("start...");
Connection pdb;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(java.lang.ClassNotFoundException e)
{
System.out.println("err:class.forname.");
}
try
{
pdb=DriverManager.getConnection("jdbc:odbc:city","","");
Statement stmt=pdb.createStatement();
ResultSet rs=stmt.executeQuery("select * from 体育3000米");
if(rs!=null)
{
System.out.println("get data from database:");
while(rs.next())
{
array1[rs.getInt("ID")-1]=rs.getString("题目");
array2[5*rs.getInt("ID")-5]=rs.getString("选项1");
array2[5*rs.getInt("ID")-4]=rs.getString("选项2");
array2[5*rs.getInt("ID")-3]=rs.getString("选项3");
array2[5*rs.getInt("ID")-2]=rs.getString("选项4");
array2[5*rs.getInt("ID")-1]=rs.getString("选项5");
array3[rs.getInt("ID")-1]=rs.getInt("结果");
}
}
rs.close();
stmt.close();
pdb.close();
}
catch(Exception e)
{
e.printStackTrace();
}
for(int i=0;i
import java.util.*;
import java.sql.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class db1 extends Applet implements ItemListener
{ CardLayout clt=new CardLayout();
int a[]=new int[40];
int r=0,n=0;
Panel pp=new Panel();
Panel p[]=new Panel[40];
String array1[]=new String[40];
Label l[]=new Label[40];
Panel p1=new Panel();
Label l1=new Label("分数");
int array3[]=new int[40];
TextField t1=new TextField();
CheckboxGroup ck[]=new CheckboxGroup[40];
Checkbox cx[]=new Checkbox[200];
String array2[]=new String[200];
public void init()
{System.out.println("start...");
Connection pdb;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(java.lang.ClassNotFoundException e)
{
System.out.println("err:class.forname.");
}
try
{
pdb=DriverManager.getConnection("jdbc:odbc:city","","");
Statement stmt=pdb.createStatement();
ResultSet rs=stmt.executeQuery("select * from 体育3000米");
if(rs!=null)
{
System.out.println("get data from database:");
while(rs.next())
{
array1[rs.getInt("ID")-1]=rs.getString("题目");
array2[5*rs.getInt("ID")-5]=rs.getString("选项1");
array2[5*rs.getInt("ID")-4]=rs.getString("选项2");
array2[5*rs.getInt("ID")-3]=rs.getString("选项3");
array2[5*rs.getInt("ID")-2]=rs.getString("选项4");
array2[5*rs.getInt("ID")-1]=rs.getString("选项5");
array3[rs.getInt("ID")-1]=rs.getInt("结果");
}
}
rs.close();
stmt.close();
pdb.close();
}
catch(Exception e)
{
e.printStackTrace();
}
for(int i=0;i