Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
476 views
in Technique[技术] by (71.8m points)

java - Warning: Looking for usage map at page 1774, but page type is 1 in UCanAccess

When trying to run a program that interfaces with Access 2010 it throws the error

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

and then proceeds to throw errors about user lacks privilege to access the table I'm trying to use.

This program seems to work perfectly fine when using Access 2013, and it worked once on Access 2010 when I tried the update statement for the first time. Now it doesn't work at all.

I can't seem to find any reference to this error anywhere online, so I'm hoping someone else has encountered it before.

It throws an error on this line of code, which it doesn't do when interfacing with Access 2013:

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

The entire method is:

 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{}
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

As Gord said, the problem is detected and logged by jackcess and it's likely caused by a accdb file corruption (I would try to fix it with the Compact and repair Access tool). Also, it may be in turn caused by its use in a sync dropbox folder. Thus, that the file was modified via UCanAccess or in another way is irrelevant, because all happened at a lower layer. Please, find similar issues reported in the jackcess forum (yes, they are googlable, did you remove the page number?)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...