How to change SortOrder to avoid “unsupported collating sort order” error?

前端 未结 1 927
萌比男神i
萌比男神i 2020-12-11 09:23

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

相关标签:
1条回答
  • 2020-12-11 10:20

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

    • opening the database in Access,
    • changing the "New database sort order" (see screenshot below) to "General - Legacy", and then
    • performing a Compact and Repair Database operation.

    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.

    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)) {
    }
    

    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.

    0 讨论(0)
提交回复
热议问题