Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-315

can't connect to server when character_set_server is set to UTF16

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 2.3.3, 3.0.3
    • 3.0.4, 2.3.6
    • None
    • None
    • Linux

    Description

      When I am trying to connect to a MySQL server with character_set_server set to utf16, it returns error:
      *Variable 'character_set_client' can't be set to the value of 'utf16'. *

      I am able to connect to the server using MySQL and MariaDB(10.2.10-MariaDB) command line tools.

      Attachments

        Activity

          sandhyasriraj Sandhya Sriraj created issue -
          georg Georg Richter added a comment -

          Sorry, but I don't understand your issue:

          Can you please explain how you connect with command line client with client_character_set utf16 ?

          georg Georg Richter added a comment - Sorry, but I don't understand your issue: Can you please explain how you connect with command line client with client_character_set utf16 ?

          Added character_set_server=utf16 in my.cnf file and restarted server to set character_set_server.

          From command line:
          >mysql -hlocalhost -uusername -p -Pport
          it is connecting.

          When I use sample program(MariaDB C connector) to connect to the same server it is giving error "Variable 'character_set_client' can't be set to the value of 'utf16".

          sandhyasriraj Sandhya Sriraj added a comment - Added character_set_server=utf16 in my.cnf file and restarted server to set character_set_server. From command line: >mysql -hlocalhost -uusername -p -Pport it is connecting. When I use sample program(MariaDB C connector) to connect to the same server it is giving error "Variable 'character_set_client' can't be set to the value of 'utf16".
          sandhyasriraj Sandhya Sriraj made changes -
          Field Original Value New Value
          Description When I am trying to connect to a MySQL server with character_set_server is set to utf16, it returns error:
          *Variable 'character_set_client' can't be set to the value of 'utf16'. *

          I am able to connect to the server using MySQL and MariaDB(10.2.10-MariaDB) command line tools.
          When I am trying to connect to a MySQL server with character_set_server set to utf16, it returns error:
          *Variable 'character_set_client' can't be set to the value of 'utf16'. *

          I am able to connect to the server using MySQL and MariaDB(10.2.10-MariaDB) command line tools.
          georg Georg Richter added a comment -

          The mysql command line client specifies a default character set before connecting to server:

          mysql -uroot -e"SELECT @@character_set_client,@@character_set_server";
          +------------------------+------------------------+
          | @@character_set_client | @@character_set_server |
          +------------------------+------------------------+
          | utf8                   | utf16                  |
          +------------------------+------------------------+
           
          mysql -uroot --default-character-set=utf16;
          ERROR 1231 (42000): Variable 'character_set_client' can't be set to the value of 'utf16'
          

          If no client character set was specified, the client will use the server character set. This is of course not possible for several character sets like utf16 or ucs2 and will abort the connection.

          georg Georg Richter added a comment - The mysql command line client specifies a default character set before connecting to server: mysql -uroot -e"SELECT @@character_set_client,@@character_set_server"; +------------------------+------------------------+ | @@character_set_client | @@character_set_server | +------------------------+------------------------+ | utf8 | utf16 | +------------------------+------------------------+   mysql -uroot --default-character-set=utf16; ERROR 1231 (42000): Variable 'character_set_client' can't be set to the value of 'utf16' If no client character set was specified, the client will use the server character set. This is of course not possible for several character sets like utf16 or ucs2 and will abort the connection.
          georg Georg Richter made changes -
          issue.field.resolutiondate 2018-03-07 07:52:41.0 2018-03-07 07:52:41.718
          georg Georg Richter made changes -
          Fix Version/s N/A [ 19504 ]
          Resolution Not a Bug [ 6 ]
          Status Open [ 1 ] Closed [ 6 ]

          I am able to connect to that server using MariaDB client(10.2.10-MariaDB) also. MariaDB 10.2 all client tools use C/C 3.0.x. Is MariaDB client also set default character set before connecting to the server?

          sandhyasriraj Sandhya Sriraj added a comment - I am able to connect to that server using MariaDB client(10.2.10-MariaDB) also. MariaDB 10.2 all client tools use C/C 3.0.x. Is MariaDB client also set default character set before connecting to the server?
          georg Georg Richter added a comment -

          Command line client use settings from configuration file or if not specified sets the default client character set to utf8 (and in older versions to latin1).

          georg Georg Richter added a comment - Command line client use settings from configuration file or if not specified sets the default client character set to utf8 (and in older versions to latin1).

          Tried adding default-character-set=utf8 to my.cnf but the issue still persists. Can you please tell me the parameters required to add in my.cnf file so that it will connect to that server programmatically.

          sandhyasriraj Sandhya Sriraj added a comment - Tried adding default-character-set=utf8 to my.cnf but the issue still persists. Can you please tell me the parameters required to add in my.cnf file so that it will connect to that server programmatically.

          Tried with MySQL #[Connector/C 6.1.11 and I am able to connect to the MySQL server. The issue is reproducible only with MariaDB C connector.

          sandhyasriraj Sandhya Sriraj added a comment - Tried with MySQL #[Connector/C 6.1.11 and I am able to connect to the MySQL server. The issue is reproducible only with MariaDB C connector.
          georg Georg Richter added a comment - - edited

          Hi Sandhya,

          thanks for the update. Looks like you forgot to attach the source of your test case.

          georg Georg Richter added a comment - - edited Hi Sandhya, thanks for the update. Looks like you forgot to attach the source of your test case.
          sandhyasriraj Sandhya Sriraj made changes -
          Attachment mysql.cpp [ 45347 ]
          sandhyasriraj Sandhya Sriraj made changes -
          Attachment mysql.cpp [ 45347 ]
          sandhyasriraj Sandhya Sriraj made changes -
          Attachment mysql.cpp [ 45348 ]

          mysql.cpp

          Sample program attached. To reproduce this issue set character_set_server set to utf16 in my.cnf.

          sandhyasriraj Sandhya Sriraj added a comment - mysql.cpp Sample program attached. To reproduce this issue set character_set_server set to utf16 in my.cnf.
          sandhyasriraj Sandhya Sriraj added a comment - - edited

          Any update on this issue?
          Please reopen this issue as it is not solved yet.

          sandhyasriraj Sandhya Sriraj added a comment - - edited Any update on this issue? Please reopen this issue as it is not solved yet.
          pramod.mahto@mariadb.com Pramod Mahto made changes -
          Resolution Not a Bug [ 6 ]
          Status Closed [ 6 ] Stalled [ 10000 ]
          julien.fritsch Julien Fritsch made changes -
          Fix Version/s N/A [ 19504 ]
          ralf.gebhardt Ralf Gebhardt made changes -
          Fix Version/s 3.0.4 [ 22922 ]
          Fix Version/s 2.3.6 [ 23004 ]
          georg Georg Richter added a comment -

          Fixed in Connector/C 2.3.6 and 3.0.4

          georg Georg Richter added a comment - Fixed in Connector/C 2.3.6 and 3.0.4
          georg Georg Richter made changes -
          issue.field.resolutiondate 2018-04-18 05:42:01.0 2018-04-18 05:42:01.851
          georg Georg Richter made changes -
          Resolution Fixed [ 1 ]
          Status Stalled [ 10000 ] Closed [ 6 ]
          julien.fritsch Julien Fritsch made changes -
          Workflow MariaDB connectors [ 85885 ] MariaDB v4 [ 161103 ]

          People

            georg Georg Richter
            sandhyasriraj Sandhya Sriraj
            Votes:
            1 Vote for this issue
            Watchers:
            5 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.