1

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{}
}
AndyReifman
  • 1,459
  • 4
  • 18
  • 34
  • Is this a programming question or are you looking for technical support for this unspecified program? It's going to be extremely difficult to help you with the details provided at the moment. – tnw Feb 11 '15 at 19:52
  • @tnw This is a program that I wrote. I'm pretty certain that UCanAccess is what's causing the problem, however it's not possible to tell as it doesn't reference it at the start of the warning. – AndyReifman Feb 11 '15 at 19:54
  • @stevesliva I'll update the post with the line it's got issues with. – AndyReifman Feb 11 '15 at 19:55
  • @Eabryt How are we supposed to help you figure out what the problem is without any code? *Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve)*. – tnw Feb 11 '15 at 19:55
  • I ran into this in moderation... you needed to make it clear it was your code. Thanks for the update. Good luck with the un-googlable error. – stevesliva Feb 11 '15 at 19:57
  • @tnw I've updated it to include the entire method. As well as pointing out which line causes problems. – AndyReifman Feb 11 '15 at 20:01
  • It sounds like an error message from Jackcess, which is the record manager layer that UCanAccess uses. Specifically, it retrieved a page of data from the .accdb file expecting it to be a certain type of page ("usage map") and it apparently got something else (a page whose type=1). I notice that your .accdb file is in a Dropbox folder. Is there any possibility that you had the same Dropbox file open on two different machines at the same time? – Gord Thompson Feb 11 '15 at 20:19
  • @GordThompson I have Dropbox open on a few different machines, but none of them actually have the older open (Except the current laptop). I do have the .accdb file open, however that's never seemed to cause any problems before. – AndyReifman Feb 11 '15 at 20:38

1 Answers1

4

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?)

jamadei
  • 1,700
  • 9
  • 8
  • I googled without the page number to no success. I ran the compact & repair tool and it worked. My concern now is that it's temporary and I'll have to run it again down the line, which could be troublesome if it's in the middle of trying to use the program. For now though that seems to work. It will be getting some heavy testing over the next few weeks hopefully. – AndyReifman Feb 11 '15 at 23:24
  • 1
    @Eabryt While I have no hard evidence to back up my claim, it still seems to me that opening an Access database directly from a Dropbox share is a "Bad Idea" if there is *any* chance that more than one user/process might do it at the same time. See related question [here](http://stackoverflow.com/q/19328371/2144390). – Gord Thompson Feb 12 '15 at 00:15