The TLSv1 and TLSv1.1 connection protocols now are deprecated and support for them is subject to removal in a future Connector/C++ version. (For background, refer to the IETF memo Deprecating TLSv1.0 and TLSv1.1.) It is recommended that connections be made using the more-secure TLSv1.2 and TLSv1.3 protocols. TLSv1.3 requires that both the server and Connector/C++ be compiled with OpenSSL 1.1.1 or higher. (WL #14584)
Applications that use the legacy JDBC API now can establish connections for accounts that use the
authentication_kerberosserver-side authentication plugin, provided that the correct Kerberos tickets are available or can be obtained from Kerberos. This capability is available on client hosts running Linux only.
It is possible to connect to Kerberos-authenticated accounts without giving a user name under these conditions:
The user has a Kerberos principal name assigned, a MySQL Kerberos account for that principal name exists, and the user has the required tickets.
The default authentication method must be set to the
authentication_kerberos_clientclient-side authentication plugin using the
It is possible to connect without giving a password, provided that the user has the required tickets in the Kerberos cache (for example, created by kinit or a similar command).
If the required tickets are not present in the Kerberos cache and a password was given, Connector/C++ obtains the tickets from Kerberos using that password. If the required tickets are found in the cache, any password given is ignored and the connection might succeed even if the password is incorrect.
For more information about Kerberos authentication, see Kerberos Pluggable Authentication. (WL #14439)
Applications that use the legacy JDBC API now can define query attribute metadata on a per-query basis. without the use of workarounds such as specially formatted comments included in query strings. This capability is implemented using type-specific methods for the
int Statement::setQueryAttrInt(attr_name, int_value); int Statement::setQueryAttrString(attr_name, str_value); int Statement::setQueryAttrBoolean(attr_name, bool_value);
Each method takes a string-valued attribute name and an attribute value of the appropriate type. The return value is the attribute number, or 0 if the server does not support query attributes.
Similar methods are implemented for the
sql::PreparedStatementclass but do nothing because the MySQL client library does not yet support query attributes for prepared statements.
Attributes defined using the set-attribute methods apply to the next SQL statement sent to the server for execution. If an attribute with a given name is defined multiple times, the last definition applies. Attributes are cleared after the statement executes, or may be cleared explicitly using the
mysql_query_attribute_string()function returns the current value for a given attribute, except that the value of an attribute with an empty name cannot be retrieved.
std::unique_ptr<sql::Statement> stmt(con->createStatement()); // Set three query attributes for a query without parameters ("SELECT 1"), // where the attribute types are int, string, and bool: stmt->setQueryAttrInt("attr1", 200); stmt->setQueryAttrString("attr2", "string value"); stmt->setQueryAttrBoolean("attr3", true); // To retrieve the attributes within a query, use the // mysql_query_attribute_string() function: stmt->execute("SELECT 1, mysql_query_attribute_string('attr1'), mysql_query_attribute_string('attr2'), mysql_query_attribute_string('attr3')"); // Change an attribute value: stmt->setQueryAttrInt("attr1", 100); // Executing the statement here and fetching the result should show the // changed attribute value. // Clear the attributes: stmt->clearAttributes(); // Executing the statement here and fetching the result should show the // the attributes are no longer present.
For the query-attribute capability to work within Connector/C++ applications, server-side support for query attributes must be enabled. For instructions, and for more information about query-attribute support in general, see Query Attributes. (WL #14216)
For connection attempts that specified a list of servers to try, the connection timeout value could be twice the correct duration. (Bug #32781963)
Connector/C++ returned error 0 for connection failures rather than a nonzero error code. (Bug #32695580)
sql::Connection:commit()threw no error if the connection had been dropped. (Bug #23235968)