尝试运行与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{}
}
答案 0 :(得分:3)
正如戈德所说,问题是由jackcess检测并记录的,这可能是由于accdb文件损坏造成的(我会尝试用Compact修复它并修复Access工具)。此外,它可能由于在同步保管箱文件夹中的使用而导致。因此,通过UCanAccess或以其他方式修改文件是无关紧要的,因为所有文件都发生在较低层。请找一下jackcess论坛中报告的类似问题(是的,它们是googlable,您是否删除了页码?)