简体   繁体   中英

“unsupported collating sort order” when trying to read from Access using Jackcess (Java)

I'm currently working on a Java application with the purpuose of reading a Microsoft Access file using Jackcess open source library. The Java application will later present the tables contained in the Access file.

Here is my code so far:

public class Test {

    public static void main(String[] args) throws IOException {

        File file = new File("\\\\student.local\\Files\\Home\\nat12mja\\Downloads\\Testdoc.accdb");
        Database db = DatabaseBuilder.open(file);

        Table table = db.getTable("Table1");

        for(Row row : table){
            System.out.println(row.get("Field1"));
        }    

    }
}

These are my imports:

    import java.io.File;
    import java.io.IOException;
    import com.healthmarketscience.jackcess.Database;
    import com.healthmarketscience.jackcess.DatabaseBuilder;

Also, I've added these Jar files to my referenced librarys:

commons-lang-2.4.jar, commons-logging-1.1.jar, jackcess-2.0.2.jar

When I run my application I get this error message(The System.out.println() works as intended):

    dec 21, 2013 1:54:27 EM com.healthmarketscience.jackcess.impl.IndexData setUnsupportedReason
    WARNING: unsupported collating sort order SortOrder[1053(0)] for text index, making read-only
    dec 21, 2013 1:54:27 EM com.healthmarketscience.jackcess.impl.DatabaseImpl readSystemCatalog
    INFO: Could not find expected index on table MSysObjects

I've tested with older versions of the same Access file, but the problem persists.

Is this a library related problem? Or am I missing something else?

Jackcess only supports indexes on Text fields in an Access database when the database is using the "General" sort order (ref: here ).

According to the related Microsoft Office support page :

To reset the sort order for an existing database, select the language you want to use and then run a compact operation on the database.

So, for Access 2010 that would presumably mean selecting File > Options from the Access ribbon bar, choosing "General" or "General - Legacy" for the "New database sort order" on the "General" tab, ...

屏幕截图

... then performing a "Compact and Repair" on the database.

Note: If Windows is using a non-English locale then the procedure described above might not rectify the problem. See this answer for details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM