Documentation Home
Connectors and APIs Manual
Download this Manual
PDF (US Ltr) - 4.5Mb
PDF (A4) - 4.5Mb


3.5.3 Configuration Properties

Configuration properties define how Connector/J will make a connection to a MySQL server. Unless otherwise noted, properties can be set for a DataSource object or for a Connection object.

Configuration properties can be set in one of the following ways:

  • Using the set*() methods on MySQL implementations of java.sql.DataSource (which is the preferred method when using implementations of java.sql.DataSource):

    • com.mysql.cj.jdbc.MysqlDataSource

    • com.mysql.cj.jdbc.MysqlConnectionPoolDataSource

  • As a key-value pair in the java.util.Properties instance passed to DriverManager.getConnection() or Driver.connect()

  • As a JDBC URL parameter in the URL given to java.sql.DriverManager.getConnection(), java.sql.Driver.connect() or the MySQL implementations of the javax.sql.DataSource setURL() method. If you specify a configuration property in the URL without providing a value for it, nothing will be set; for example, adding useServerPrepStmts alone to the URL does not make Connector/J use server-side prepared statements; you need to add useServerPrepStmts=true.

    Note

    If the mechanism you use to configure a JDBC URL is XML-based, use the XML character literal & to separate configuration parameters, as the ampersand is a reserved character for XML.

The properties are listed by categories in the following tables and then in the subsections that follow. Click on a property name in the tables to see its full description in the subsections.

Table 3.4 Authentication Properties

Name Default Value Since Version
user - all versions
password - all versions
password1 - 8.0.28
password2 - 8.0.28
password3 - 8.0.28
authenticationPlugins - 5.1.19
disabledAuthenticationPlugins - 5.1.19
defaultAuthenticationPlugin caching_sha2_password 5.1.19
ldapServerHostname - 8.0.23
ociConfigFile - 8.0.27
ociConfigProfile DEFAULT 8.0.33
authenticationWebAuthnCallbackHandler - 8.2.0

Table 3.5 Connection Properties

Name Default Value Since Version
connectionAttributes - 5.1.25
connectionLifecycleInterceptors - 5.1.4
useConfigs - 3.1.5
clientInfoProvider com.mysql.cj.jdbc.CommentClientInfoProvider 5.1.0
createDatabaseIfNotExist false 3.1.9
databaseTerm CATALOG 8.0.17
detectCustomCollations false 5.1.29
disconnectOnExpiredPasswords true 5.1.23
interactiveClient false 3.1.0
passwordCharacterEncoding - 5.1.7
propertiesTransform - 3.1.4
rollbackOnPooledClose true 3.0.15
useAffectedRows false 5.1.7

Table 3.6 Session Properties

Name Default Value Since Version
sessionVariables - 3.1.8
characterEncoding - 1.1g
characterSetResults - 3.0.13
connectionCollation - 3.0.13
customCharsetMapping - 8.0.26
trackSessionState false 8.0.26

Table 3.7 Networking Properties

Name Default Value Since Version
socksProxyHost - 5.1.34
socksProxyPort 1080 5.1.34
socketFactory com.mysql.cj.protocol.StandardSocketFactory 3.0.3
connectTimeout 0 3.0.1
socketTimeout 0 3.0.1
dnsSrv false 8.0.19
localSocketAddress - 5.0.5
maxAllowedPacket 65535 5.1.8
socksProxyRemoteDns false 8.0.29
tcpKeepAlive true 5.0.7
tcpNoDelay true 5.0.7
tcpRcvBuf 0 5.0.7
tcpSndBuf 0 5.0.7
tcpTrafficClass 0 5.0.7
useCompression false 3.0.17
useUnbufferedInput true 3.0.11


Table 3.9 Statements Properties

Name Default Value Since Version
cacheDefaultTimeZone true 8.0.20
continueBatchOnError true 3.0.3
dontTrackOpenResources false 3.1.7
queryInterceptors - 8.0.7
queryTimeoutKillsConnection false 5.1.9

Table 3.10 Prepared Statements Properties


Table 3.11 Result Sets Properties


Table 3.12 Metadata Properties

Name Default Value Since Version
getProceduresReturnsFunctions true 5.1.26
noAccessToProcedureBodies false 5.0.3
nullDatabaseMeansCurrent false 3.1.8
useHostsInPrivileges true 3.0.2
useInformationSchema false 5.0.0

Table 3.13 BLOB/CLOB processing Properties

Name Default Value Since Version
blobSendChunkSize 1048576 3.1.9
blobsAreStrings false 5.0.8
clobCharacterEncoding - 5.0.0
emulateLocators false 3.1.0
functionsNeverReturnBlobs false 5.0.8
locatorFetchBufferSize 1048576 3.2.1

Table 3.14 Datetime types processing Properties



Table 3.16 Performance Extensions Properties


Table 3.17 Debugging/Profiling Properties

Name Default Value Since Version
logger com.mysql.cj.log.StandardLogger 3.1.1
profilerEventHandler com.mysql.cj.log.LoggingProfilerEventHandler 5.1.6
useNanosForElapsedTime false 5.0.7
maxQuerySizeToLog 2048 3.1.3
maxByteArrayAsHex 1024 8.0.31
profileSQL false 3.1.0
logSlowQueries false 3.1.2
slowQueryThresholdMillis 2000 3.1.2
slowQueryThresholdNanos 0 5.0.7
autoSlowLog true 5.1.4
explainSlowQueries false 3.1.2
gatherPerfMetrics false 3.1.2
reportMetricsIntervalMillis 30000 3.1.2
logXaCommands false 5.0.5
traceProtocol false 3.1.2
enablePacketDebug false 3.1.3
packetDebugBufferSize 20 3.1.3
useUsageAdvisor false 3.1.1
resultSetSizeThreshold 100 5.0.5
autoGenerateTestcaseScript false 3.1.9
openTelemetry PREFERRED 8.4.0

Table 3.18 Exceptions/Warnings Properties


Table 3.19 Tunes for integration with other products Properties

Name Default Value Since Version
overrideSupportsIntegrityEnhancementFacility false 3.1.12
ultraDevHack false 2.0.3

Table 3.20 JDBC compliance Properties

Name Default Value Since Version
useColumnNamesInFindColumn false 5.1.7
pedantic false 3.0.0
useOldAliasMetadataBehavior false 5.0.4