Documentation Home
MySQL Connector/J 8.0 Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 0.8Mb
PDF (A4) - 0.8Mb
HTML Download (TGZ) - 146.6Kb
HTML Download (Zip) - 165.9Kb


6.3.2 Connection

  • connectionAttributes

    A comma-delimited list of user-defined key:value pairs (in addition to standard MySQL-defined key:value pairs) to be passed to MySQL Server for display as connection attributes in the PERFORMANCE_SCHEMA.SESSION_CONNECT_ATTRS table. Example usage: connectionAttributes=key1:value1,key2:value2 This functionality is available for use with MySQL Server version 5.6 or later only. Earlier versions of MySQL Server do not support connection attributes, causing this configuration option to be ignored. Setting connectionAttributes=none will cause connection attribute processing to be bypassed, for situations where Connection creation/initialization speed is critical.

    Since Version 5.1.25
  • connectionLifecycleInterceptors

    A comma-delimited list of classes that implement "com.mysql.cj.jdbc.interceptors.ConnectionLifecycleInterceptor" that should notified of connection lifecycle events (creation, destruction, commit, rollback, setting the current database and changing the autocommit mode) and potentially alter the execution of these commands. ConnectionLifecycleInterceptors are "stackable", more than one interceptor may be specified via the configuration property as a comma-delimited list, with the interceptors executed in order from left to right.

    Since Version 5.1.4
  • useConfigs

    Load the comma-delimited list of configuration properties before parsing the URL or applying user-specified properties. These configurations are explained in the 'Configurations' of the documentation.

    Since Version 3.1.5
  • authenticationPlugins

    Comma-delimited list of classes that implement the interface com.mysql.cj.protocol.AuthenticationPlugin. These plugins will be loaded at connection initialization and can be used together with their sever-side counterparts for authenticating users, unless they are also disabled in the connection property 'disabledAuthenticationPlugins'.

    Since Version 5.1.19
  • clientInfoProvider

    The name of a class that implements the com.mysql.cj.jdbc.ClientInfoProvider interface in order to support JDBC-4.0's Connection.get/setClientInfo() methods

    Default Value com.mysql.cj.jdbc.CommentClientInfoProvider
    Since Version 5.1.0
  • createDatabaseIfNotExist

    Creates the database given in the URL if it doesn't yet exist. Assumes the configured user has permissions to create databases.

    Default Value false
    Since Version 3.1.9
  • databaseTerm

    MySQL uses the term "schema" as a synonym of the term "database," while Connector/J historically takes the JDBC term "catalog" as synonymous to "database". This property sets for Connector/J which of the JDBC terms "catalog" and "schema" is used in an application to refer to a database. The property takes one of the two values CATALOG or SCHEMA and uses it to determine (1) which Connection methods can be used to set/get the current database (e.g. setCatalog() or setSchema()?), (2) which arguments can be used within the various DatabaseMetaData methods to filter results (e.g. the catalog or schemaPattern argument of getColumns()?), and (3) which fields in the ResultSet returned by DatabaseMetaData methods contain the database identification information (i.e., the TABLE_CAT or TABLE_SCHEM field in the ResultSet returned by getTables()?).

    If databaseTerm=CATALOG, schemaPattern for searches are ignored and calls of schema methods (like setSchema() or get Schema()) become no-ops, and vice versa.

    Default Value CATALOG
    Since Version 8.0.17
  • defaultAuthenticationPlugin

    The default authentication plugin client-side protocol name or a fully qualified name of a class that implements the interface com.mysql.cj.protocol.AuthenticationPlugin. The specified authentication plugin must be either one of the built-in authentication plugins or one of the plugins listed in the property 'authenticationPlugins'. Additionally, the default authentication plugin cannot be disabled with the property 'disabledAuthenticationPlugins'. Neither an empty nor unknown plugin name or class can be set for this property.

    By default, Connector/J honors the server-side default authentication plugin, which is known after receiving the initial handshake packet, and falls back to this propertys default value if that plugin cannot be used. However, when a value is explicitly provided to this property, Connector/J then overrides the server-side default authentication plugin and always tries first the plugin specified with this property.

    Default Value mysql_native_password
    Since Version 5.1.19
  • detectCustomCollations

    Should the driver detect custom charsets/collations installed on server (true/false, defaults to 'false'). If this option set to 'true' driver gets actual charsets/collations from server each time connection establishes. This could slow down connection initialization significantly.

    Default Value false
    Since Version 5.1.29
  • disabledAuthenticationPlugins

    Comma-delimited list of authentication plugins client-side protocol names or classes implementing the interface com.mysql.cj.protocol.AuthenticationPlugin. The authentication plugins listed will not be used for authenticating users and, if anyone of them is required during the authentication exchange, the connection fails. The default authentication plugin specified in the property 'defaultAuthenticationPlugin' cannot be disabled.

    Since Version 5.1.19
  • disconnectOnExpiredPasswords

    If "disconnectOnExpiredPasswords" is set to "false" and password is expired then server enters "sandbox" mode and sends ERR(08001, ER_MUST_CHANGE_PASSWORD) for all commands that are not needed to set a new password until a new password is set.

    Default Value true
    Since Version 5.1.23
  • interactiveClient

    Set the CLIENT_INTERACTIVE flag, which tells MySQL to timeout connections based on INTERACTIVE_TIMEOUT instead of WAIT_TIMEOUT

    Default Value false
    Since Version 3.1.0
  • ldapServerHostname

    When using MySQL's LDAP pluggable authentication with GSSAPI/Kerberos authentication method, allows setting the LDAP service principal hostname as configured in the Kerberos KDC. If this property is not set, Connector/J takes the system property 'java.security.krb5.kdc' and extracts the hostname (short name) from its value and uses it. If neither is set, the connection fails with an exception.

    Since Version 8.0.23
  • passwordCharacterEncoding

    What character encoding is used for passwords? Leaving this set to the default value (null), uses the value set in "characterEncoding" if there is one, otherwise uses UTF-8 as default encoding. If the password contains non-ASCII characters, the password encoding must match what server encoding was set to when the password was created. For passwords in other character encodings, the encoding will have to be specified with this property (or with "characterEncoding"), as it's not possible for the driver to auto-detect this.

    Since Version 5.1.7
  • propertiesTransform

    An implementation of com.mysql.cj.conf.ConnectionPropertiesTransform that the driver will use to modify URL properties passed to the driver before attempting a connection

    Since Version 3.1.4
  • rollbackOnPooledClose

    Should the driver issue a rollback() when the logical connection in a pool is closed?

    Default Value true
    Since Version 3.0.15
  • useAffectedRows

    Don't set the CLIENT_FOUND_ROWS flag when connecting to the server (not JDBC-compliant, will break most applications that rely on "found" rows vs. "affected rows" for DML statements), but does cause "correct" update counts from "INSERT ... ON DUPLICATE KEY UPDATE" statements to be returned by the server.

    Default Value false
    Since Version 5.1.7