如题,我用CachedRowSetImpl实例化时,Eclipse报错:说我访问类库的时候被拒绝!!那位大虾指点一下?!

解决方案 »

  1.   

    CachedRowSet rowset = new CachedRowSetImpl();
    然后Eclipse就说:访问限制:由于对必须的库C:\Program Files\Java\jre6\lib\rt.jar具有一定限制,因此无法访问构造函数CachedRowSetImpl()可是今天我又试了试,它又不报错了,真令人费解。
      

  2.   

    import   sun.jdbc.rowset.*; 
    import   java.sql.*; 
    import   javax.swing.table.*; 
    import   javax.swing.*; 
    import   javax.swing.event.*; 
    import   java.util.*; 
    import   javax.sql.*; public   class   Organization   implements   TableModelListener{ 
        private   CachedRowSet   rowset; 
        private   DefaultTableModel   tableModel; 
        public   Organization()   { 
            try{ 
                rowset=new   CachedRowSetImpl(); 
                rowset.setType(ResultSet.TYPE_SCROLL_INSENSITIVE); 
                rowset.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); 
            }catch   (Exception   e)   { 
                e.printStackTrace(System.out); 
            } 
            receive(); 
        }     public   TableModel   receive(){ 
            try{ 
                Connection   conn=Constants.dataConnections.lendConnection(); 
                rowset.release(); 
                rowset.setTableName( "groups "); 
                rowset.setCommand( "select   name,intro,admin   from   groups "); 
                rowset.execute(conn); 
                Constants.dataConnections.returnConnection(conn); 
            }catch   (Exception   e)   { 
                e.printStackTrace(); 
            } 
            tableModel=rsToTable(rowset); 
            return   tableModel; 
        }     
        public   boolean   save()   { 
            boolean   isSave=true; 
            try   { 
                Connection   conn   =   Constants.dataConnections.lendConnection(); 
                rowset.acceptChanges(conn); 
                Constants.dataConnections.returnConnection(conn); 
            }   catch   (Exception   e)   { 
                e.printStackTrace(); 
                isSave=false; 
            } 
            return   isSave; 
        } 
        }