Bug #111619 connection_properties is ineffective
Submitted: 29 Jun 2023 8:03 Modified: 7 Jul 2023 5:51
Reporter: 越 马 Email Updates:
Status: Unsupported Impact on me:
None 
Category:Connector / C++ Severity:S2 (Serious)
Version:5.7.38 OS:Linux
Assigned to: CPU Architecture:Any

[29 Jun 2023 8:03] 越 马
Description:
db default param:

character_set_client=latin1
character_set_connection=latin1
character_set_results=latin1
character_set_server=latin1

code:

 sql::ConnectOptionsMap connection_properties;
            connection_properties["hostName"]                = ip;
            connection_properties["userName"]                = user;
            connection_properties["password"]                = passwd;
            connection_properties["schema"]                  = db_name;
            connection_properties["port"]                    = port;
            connection_properties["CLIENT_MULTI_STATEMENTS"] = (true);
            connection_properties["OPT_RECONNECT"] = (true);
            connection_properties["OPT_CHARSET_NAME"] = "utf8mb4";
            connection_properties["characterSetResults"] = "utf8mb4";
            connection_properties["useOldAliasMetadataBehavior"] = (true);
            connection_properties["OPT_CONNECT_TIMEOUT"] = (1*30);
            conn = JDBCDriver::Instance().Getinstance()->connect(connection_properties);

we execute 'show variables' after create the connection,but the result is unmodified:

character_set_client=latin1
character_set_connection=latin1
character_set_results=latin1
character_set_server=latin1

why connection_properties is ineffective?

How to repeat:
create a new connection
[29 Jun 2023 13:06] MySQL Verification Team
Hi Mr. 越 马,

Thank you for taking the time to report a problem.  Unfortunately you are not using a current version of the product you reported a problem with -- the problem might already be fixed. Please download a new version from http://www.mysql.com/downloads/

Please, send us a full test case for MySQL Server 8.0.33 and Connector/C++ for 8.0.33. Also, provide us with your entire relevant part of the code, so that we do not have a code of our own. Also, describe in detail the behaviour that you consider a bug.

Also, you have set a category for C++. Are you sure it is not Java ???

If you are able to reproduce the bug with one of the latest versions, please change the version on this bug report to the version you tested and we shall change the status..  Again, thank you for your continued support of MySQL.

Unsupported.
[7 Jul 2023 5:51] 越 马
Whether the OPT_CHARSET_NAME can be changed to utf8mb4?
we set OPT_CHARSET_NAME to utf8mb4,but it did not effective
only set OPT_CHARSET_NAME to utf8 is effective
[7 Jul 2023 12:00] MySQL Verification Team
Hi,

What you have tried is not supported by 5.7.