Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-1199

Setting collation_connection with init_connect regression

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.2.0
    • 3.5.0
    • configuration
    • None
    • MySQL Server 8.4
      MariaDB Connector/J 3.2.0 or later

    Description

      I am using the collation "utf8mb4_swedish_ci" in MySQL server and to get the correct collation for clients I have used a init_connect setting that sets the collation_connection variable to the servers collation

      [mysqld]
      character_set_server=utf8mb4
      collation_server=utf8mb4_swedish_ci
      init_connect='SET collation_connection = @@collation_database;'
      

      After upgrading to at least maria db connector/j version 3.2.0 if I check the collation_connection variable its value is utf8mb4_0900_ai_ci which leads to a lot of illegal mix of collation errors when running my application.

      From show variables like '%collation%'

      |Variable_name                |Value             |
      |-----------------------------|------------------|
      |collation_connection         |utf8mb4_0900_ai_ci|
      |collation_database           |utf8mb4_swedish_ci|
      |collation_server             |utf8mb4_swedish_ci|
      |default_collation_for_utf8mb4|utf8mb4_0900_ai_ci|
      

      I have done some digging and the reason seems to be the implicit SET NAMES call that was introduced in CONJ-1092, since that call doesn't have a COLLATE it collation_connection becomes the default value. (commit 0c13897eea649a4195161a27b3f8884cbeda8415)

      As far as I can tell init_connect statements are executed after that SET NAMES call though, so I don't understand why my init_connect doesn't work to reset collation_connection to the correct value.

      I have also tried using SET NAMES with COLLATE in my init_connect but I get the same behavior (collation_connection is still utf8mb4_0900_ai_ci)

      Attachments

        Issue Links

          Activity

            People

              diego dupin Diego Dupin
              christiansvedin Christian Svedin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.