Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Does not make sense to default MySQL character set and collation properties on connection URL #1294

@tazmaniax

Description

@tazmaniax

Play Version (1.5.x / etc)

1.5.2

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

MacOS 10.14.4

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

Library Dependencies

Connector/J v5.1.47

Behaviour

Play currently adds the following default parameters to the connection URL:

  • useUnicode=yes
  • characterEncoding=UTF-8
  • connectionCollation=utf8_general_ci

The Connector/J 5.1 documentation on charsets does not recommend these properties are set instead preferring...

The character encoding between client and server is automatically detected upon connection (provided that the Connector/J connection properties characterEncoding and connectionCollation are not set).

As well if the server collation is not set to "utf8_general_ci" and that collation is not expected then unexpected results might occur.

In addition the documentation for useUnicode states that...

Should only be used when the driver can't determine the character set mapping, or you are trying to 'force' the driver to use a character set that MySQL either doesn't natively support.

I suggest these defaults are removed to allow the client to freely auto-detect the character set and collation from the server and avoid setting potentially unexpected and undesirable defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions