“不支持的整理排序顺序”尝试使用Jackcess(Java)从Access读取时 [英] "unsupported collating sort order" when trying to read from Access using Jackcess (Java)

查看:440
本文介绍了“不支持的整理排序顺序”尝试使用Jackcess(Java)从Access读取时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个Java应用程序,其中包括使用Jackcess开源库读取Microsoft Access文件。 Java应用程序稍后将显示Access文件中包含的表。



这是我到目前为止的代码:

  public class Test { 

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

文件文件=新文件(\\\\\\\\\\\\\\\\\\\\\\ \\Files\\Home\\\\
at12mja\\Downloads\\Testdoc.accdb);
数据库db = DatabaseBuilder.open(文件);

表table = db.getTable(Table1);

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

}
}

这些是我的导入:

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

此外,我已将这些Jar文件添加到我引用的图书馆:



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



当我运行我的时候应用程序我收到此错误消息(System.out.println()按预期工作):

  2013年12月21日1: 54:27 EM com.healthmarketscience.jackcess.impl.IndexData setUnsupportedReason 
警告:不支持整理排序顺序SortOrder [1053(0)]用于文本索引,使得只读
dec 21,2013 1:54 :27 EM com.healthmarketscience.jackcess.impl.DatabaseImpl readSystemCatalog
INFO:找不到表格上的预期索引MSysObjects

我已经使用相同Access文件的旧版本进行了测试,但问题仍然存在。



这是一个与库相关的问题吗?还是我错过了别的什么?

解决方案

Jackcess仅支持Access数据库中 Text 字段的索引数据库使用常规排序顺序(参考:。


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.

这篇关于“不支持的整理排序顺序”尝试使用Jackcess(Java)从Access读取时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆