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

纵然是瞬间 提交于 2019-11-27 07:10:34

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/20719417/unsupported-collating-sort-order-when-trying-to-read-from-access-using-jackces

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!