1

当尝试运行与 Access 2010 接口的程序时,它会引发错误

WARNING:Looking for usage map at page 1774, but page type is 1

然后继续抛出有关user lacks privilege访问我尝试使用的表的错误。

该程序在使用 Access 2013 时似乎运行良好,当我第一次尝试更新语句时,它在 Access 2010 上运行过一次。现在它根本不起作用。

我似乎在网上的任何地方都找不到对这个错误的任何引用,所以我希望其他人以前也遇到过。

它在这行代码中引发错误,在与 Access 2013 交互时不会这样做:

ResultSet rSet = stmt.executeQuery("Select * FROM Players");

整个方法是:

 public int addPlayer(String name, int x) throws SQLException //drafts a person to team x (ownerID)
, ClassNotFoundException
    {
    //Database db = new DatabaseBuilder().setCodecProvider(new CryptCodecProvider()).open(new File("BBFBLMasterVersion3.accdb"));
    Connection con;
    try 
    {
        Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
        con = DriverManager.getConnection("jdbc:ucanaccess://C:/Users/Andrew/Dropbox/Public/Schoolwork/IRC/BBFBLMasterVersion3.accdb"); //name of ODBC driver
        Statement stmt = con.createStatement();
        //stmt.executeQuery("SELECT * FROM DraftNightQuery");
        //ResultSet rSet = stmt.getResultSet();
        ResultSet rSet = stmt.executeQuery("Select * FROM Players");
        String[] split = name.split(" "); 
        String salary = "1";
        while(rSet.next())
        {   
            String lastName = rSet.getString("Last");
            //int x = Integer.parseInt(salary);
            if(split[0].toLowerCase().equalsIgnoreCase(lastName))
            {
                String firstName = rSet.getString("First"); //get the item from column named Team Name
                if(split[1].toLowerCase().equalsIgnoreCase(firstName))
                {
                    Statement connec = con.createStatement();
                    Statement idMatch = con.createStatement();
                    String id = rSet.getString("ID");
                    connec.executeUpdate("UPDATE Players SET OwnerID = "+x+" WHERE Last ='"+split[0]+"' AND First='"+split[1]+"' ");
                    //stmt.executeUpdate(whoToAdd);
                    ResultSet temp =idMatch.executeQuery("SELECT * FROM Salaries WHERE ID ='"+id+"'");
                    while(temp.next()){
                        String tempID = rSet.getString("ID");
                        if(id.toLowerCase().equalsIgnoreCase(tempID)){
                            salary = temp.getString("Salary");
                        }
                    }   
                    con.close();
                    connec.close();
                    stmt.close();
                    idMatch.close();
                    return Integer.parseInt(salary);
                }
            }
        }
        return 1;
    }
    finally{}
}
4

1 回答 1

4

正如 Gord 所说,这个问题是由 jackcess 检测和记录的,它可能是由 accdb 文件损坏引起的(我会尝试使用 Compact and repair Access 工具修复它)。此外,这可能是由于它在同步保管箱文件夹中的使用而引起的。因此,通过 UCanAccess 或其他方式修改文件是无关紧要的,因为所有这些都发生在较低层。请在 jackcess 论坛中找到类似的问题(是的,它们是可搜索的,您是否删除了页码?)

于 2015-02-11T21:24:04.367 回答