簡體   English   中英

通過appletviewer實用程序在applet代碼中運行的UCAExc ::: 4.0.1訪問被拒絕的異常

[英]UCAExc:::4.0.1 access denied exception running in applet code via the appletviewer utility

public class SetupExam extends Applet {
    /**
     * 
     */
    private static final long serialVersionUID = -4106575420788590877L;
    private JTextField td_tf;
    private JTextField mfeq_tf;
    private JTextField nmfe_tf;

    /**
     * Create the applet.
     */
    public SetupExam() {
        setLayout(null);
        JLabel main_l = new JLabel("Exam");
        main_l.setHorizontalAlignment(SwingConstants.CENTER);
        main_l.setFont(new Font("Arial", Font.BOLD, 15));
        main_l.setBounds(7, 4, 601, 42);
        add(main_l);

        JLabel cat_l = new JLabel("1.Category");
        cat_l.setFont(new Font("Arial", Font.PLAIN, 15));
        cat_l.setBounds(16, 80, 162, 32);
        add(cat_l);

        JLabel td_l = new JLabel("2.Time Duration");
        td_l.setFont(new Font("Arial", Font.PLAIN, 15));
        td_l.setBounds(16, 130, 162, 32);
        add(td_l);

        JLabel noq_l = new JLabel("3.Number of Questions");
        noq_l.setFont(new Font("Arial", Font.PLAIN, 15));
        noq_l.setBounds(13, 184, 165, 32);
        add(noq_l);

        JLabel mfeq_l = new JLabel("4.Marks for each Question");
        mfeq_l.setFont(new Font("Arial", Font.PLAIN, 15));
        mfeq_l.setBounds(13, 236, 178, 32);
        add(mfeq_l);

        JLabel nmfe_l = new JLabel("5.Negtive Mark For Each");
        nmfe_l.setFont(new Font("Arial", Font.PLAIN, 15));
        nmfe_l.setBounds(13, 293, 178, 32);
        add(nmfe_l);

        JComboBox cat_combo = new JComboBox();
        cat_combo.setEditable(true);
        cat_combo.setBounds(237, 80, 208, 32);
        add(cat_combo);

        td_tf = new JTextField();
        td_tf.setBounds(237, 130, 208, 32);
        add(td_tf);
        td_tf.setColumns(10);

        mfeq_tf = new JTextField();
        mfeq_tf.setColumns(10);
        mfeq_tf.setBounds(237, 236, 208, 32);
        add(mfeq_tf);

        nmfe_tf = new JTextField();
        nmfe_tf.setColumns(10);
        nmfe_tf.setBounds(237, 293, 208, 32);
        add(nmfe_tf);


        JSpinner noq_spin = new JSpinner();
        noq_spin.setModel(new SpinnerNumberModel(10, 1, 100, 1));
        noq_spin.setBounds(237, 180, 208, 32);
        add(noq_spin);



        JButton sbmt_btn = new JButton(mfun());
        sbmt_btn.setFont(new Font("Arial", Font.PLAIN, 12));
        sbmt_btn.setBounds(228, 383, 126, 41);
        add(sbmt_btn);

    }
    public String mfun()
    {
        try
        {
         Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
        Connection con=DriverManager.getConnection("jdbc:ucanaccess://C:\\workspace\\exam.mdb");
        Statement st = con.createStatement();
        ResultSet rs = st.executeQuery("Select * from  exam_setup");
        while (rs.next())
            {
                //System.out.println(rs.getString(3));
                return rs.getString(3);

            }
         } catch (Exception ex)
                   {
                System.err.print("Exception: ");
                System.err.println(ex.getMessage());
                   }
        return null;


    }

}

我正在使用Ucanacess 4.0.1。

在此之前,我通過通過Java程序在表檢查中插入數據來檢查連接性,但是當我在applet中添加代碼時,它不起作用。 我使用以下命令運行小程序

appletviewer ExamSystem.html

輸出:

例外:UCAExc ::: 4.0.1訪問被拒絕(“ java.util.logging.LoggingPermission”“控制”)

appletviewer實用程序顯然是在受限制的環境中運行applet代碼的,很可能類似於用於未簽名applet的“沙盒”。 UCanAccess並非旨在在這樣的環境中運行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM