Sidebar

What -Dconnection.url configuration properties/parameters are recommended when using MySql/MariaDB?

0 votes
168 views
asked May 18, 2020 by rich-c-2789 (15,250 points)

I noticed this question:

    How to configure the JDBC connection to the QIE database for MySql/MariaDB?

used these configuration properties in some of the examples where others did not:

    useUnicode=true

    characterEncoding=UTF-8

    serverTimezone=[timezone matching your mysql instance]

    sslMode=DISABLED

Can you explain what these are for?

1 Answer

0 votes

The connection properties mentioned above were used with the MySql driver connection urls.  The MariaDB driver also has its own connection string parameters.  All though, the examples didn't need any, that may not be the case for your configuration.  These properties/parameters are different for each driver class/driver version.

These answers are from the perspective of using these properties to connect to a MySql QIE database.  For the JDBC driver specific definitions please refer to the MySql/MariaDB references listed below.

useUnicode=true

    Used to turn on support for unicode characters so that QIE can support the full range of characters that may be received in a message.  Things like extended characters, international characters, and emojis.  For more see: https://en.wikipedia.org/wiki/List_of_Unicode_characters

characterEncoding=UTF-8

    Used with the above to specify the unicode character set to use.  See: https://en.wikipedia.org/wiki/UTF-8

serverTimezone=[timezone matching your mysql instance]

    Used to configure the driver to use the same timezone configured on the database server for transporting dates.

To find the server time zone execute this:

    SELECT @@GLOBAL.time_zone, @@SESSION.time_zone, @@system_time_zone;

Note:  The timezone configured on the server may need to be transalated to one that is recognized in java.  For example if the database server is configured to use MDT then this should be converted to java equivalent America/Denver

See: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

sslMode=DISABLED ()

    Used to tell the driver not to use secure connections.  If you need it configured otherwise see the driver and database documentation.  If QIE is deployed behind a firewall secure connections are based on your internal requirements.

See also:

    How to configure the JDBC connection to the QIE database for MySql/MariaDB?

Resources:

    https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-charsets.html

    https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-configuration-properties.html

    https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-charsets.html

    https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html

    https://mariadb.com/kb/en/about-mariadb-connector-j/#optional-url-parameters

answered May 18, 2020 by rich-c-2789 (15,250 points)
...