Documentation Home
MySQL Connector/J 8.0 Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 0.8Mb
PDF (A4) - 0.8Mb


6.3.3 Session

  • sessionVariables

    A comma or semicolon separated list of name=value pairs to be sent as SET [SESSION] ... to the server when the driver connects.

    Since Version 3.1.8
  • characterEncoding

    Instructs the server to set session system variables 'character_set_client' and 'character_set_connection' to the default character set for the specified Java encoding and set 'collation_connection' to the default collation for this character set. If neither this property nor the property 'connectionCollation' is set:

    For Connector/J 8.0.25 and earlier, the driver will try to use the server default character set;

    For Connector/J 8.0.26 and later, the driver will use "utf8mb4".

    Since Version 1.1g
  • characterSetResults

    Instructs the server to return the data encoded with the default character set for the specified Java encoding. If not set or set to "null", the server will send data in its original character set and the driver will decode it according to the result metadata.

    Since Version 3.0.13
  • connectionCollation

    Instructs the server to set session system variable 'collation_connection' to the specified collation name and set 'character_set_client' and 'character_set_connection' to the corresponding character set. This property overrides the value of 'characterEncoding' with the character set this collation belongs to. If neither this property nor the property 'characterEncoding' is set:

    For Connector/J 8.0.25 and earlier, the driver will try to use the server default character set;

    For Connector/J 8.0.26 and later, the driver will use "utf8mb4" default collation.

    Since Version 3.0.13
  • customCharsetMapping

    A comma-delimited list of custom "charset:java encoding" pairs.

    In case the MySQL server is configured with custom character sets and 'detectCustomCollations=true', Connector/J needs to know which Java character encoding to use for the data represented by these character sets. Example usage: 'customCharsetMapping=charset1:UTF-8,charset2:Cp1252'.

    Since Version 8.0.26
  • trackSessionState

    Receive server session state changes on query results. These changes are accessible via MysqlConnection.getServerSessionStateController().

    Default Value false
    Since Version 8.0.26