如何更改SortOrder以避免“不支持整理排序顺序”错误? [英] How to change SortOrder to avoid "unsupported collating sort order" error?

查看:763
本文介绍了如何更改SortOrder以避免“不支持整理排序顺序”错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用来自第三方客户端的.mdb数据库的程序。在我尝试更新数据库中的元素之前,一切都很好。 sortOrder字段不正确。我试图通过MS Access将其更改为一般,并且没有运气。我执行更新查询时收到的消息是:

I've been working on a program with a .mdb database from a third party client. Everything was fine until I've tried to update elements on the database. The sortOrder field is not correct. I've tried to change it to general with MS Access, and had no luck. The message I get when I execute the update query is:

java.lang.IllegalArgumentException: Given index Index@150ab4ed[
  name: (EXART) PrimaryKey
  number: 2
  isPrimaryKey: true
  isForeignKey: false
  data: IndexData@3c435123[
    dataNumber: 2
    pageNumber: 456
    isBackingPrimaryKey: true
    isUnique: true
    ignoreNulls: false
    columns: [
      ReadOnlyColumnDescriptor@50fe837a[
        column: Column@636e8cc[
          name: (EXART) ARCodArt
          type: 0xa (TEXT)
          number: 0
          length: 30
          variableLength: true
          compressedUnicode: true
          textSortOrder: SortOrder[3082(0)]
        ]
        flags: 1
      ]
    ]
    initialized: false
    pageCache: IndexPageCache@3a62c01e[
      pages: (uninitialized)
    ]
  ]
] is not usable for indexed lookups due to unsupported collating sort order SortOrder[3082(0)] for text index
    at com.healthmarketscience.jackcess.impl.IndexCursorImpl.createCursor(IndexCursorImpl.java:111)
    at com.healthmarketscience.jackcess.CursorBuilder.toCursor(CursorBuilder.java:302)
    at net.ucanaccess.commands.IndexSelector.getCursor(IndexSelector.java:150)
    at net.ucanaccess.commands.CompositeCommand.persist(CompositeCommand.java:83)
    at net.ucanaccess.jdbc.UcanaccessConnection.flushIO(UcanaccessConnection.java:268)
    at net.ucanaccess.jdbc.UcanaccessConnection.commit(UcanaccessConnection.java:169)
    at cultifortgestio.EntradaEixidaDades.Insercio(EntradaEixidaDades.java:76)

如您所见,Access不会更改sortOrder at所有,我认为它应该是1033,它一直是3082.有没有办法改变这个?正如我所说,更改Access并执行压缩和修复数据库对我来说不起作用。

As you can see, Access does not change the sortOrder at all, I think it should be 1033, and it keeps being 3082. Is there a way to change this? As i said, changing in Access and performing a Compact and Repair database didn't work for me.

推荐答案

与其他类似在这种情况下,解决方案是更改受影响数据库的排序顺序。这通常由

As with other similar situations, the solution was to change the sort order of the affected database. This is usually done by


  • 在Access中打开数据库完成,

  • 更改新数据库排序订购(见下面的截图)General - Legacy,然后

  • 执行压缩和修复数据库操作。

但是,这种情况下的皱纹是Windows语言环境设置为西班牙语,因此Access中的常规排序选项不会映射到UCanAccess(实际上是Jackcess)可以更新的值。提问者的解决方案是暂时将其Windows语言环境更改为英语...,执行上述步骤以更改数据库排序顺序,然后更改Windows语言环境。

However, the wrinkle in this case was that the Windows locale was set to "Spanish", so the "General" sort options in Access do not map to a value that UCanAccess (Jackcess, actually) can update. The solution for the asker was to temporarily change their Windows locale to "English ...", perform the above steps to change the database sort order, and then change the Windows locale back.

对于那些不想弄乱Windows语言环境设置的人来说,另一种解决方案是让UCanAccess通过 newDatabaseVersion 选项创建一个新的空数据库文件,例如,

For those who would prefer not to mess with their Windows locale settings, an alternative solution would be to have UCanAccess create a new empty database file via the newDatabaseVersion option, e.g.,

String connStr = "jdbc:ucanaccess://C:/someplace/new.accdb;newDatabaseVersion=V2010";
try (Connection conn = DriverManager.getConnection(connStr)) {
}

在Access中打开新数据库,然后使用导入功能将表从旧数据库文件传输到新数据库。 UCanAccess创建的数据库文件将具有与更新操作兼容的排序顺序。

open the new database in Access, and then transfer the tables from the old database file into the new one using the Import feature. The database file created by UCanAccess will have a sort order that is compatible with update operations.

这篇关于如何更改SortOrder以避免“不支持整理排序顺序”错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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