Common MySQL JdbcUrl Properties

Common Use

Character Encoding

useUnicode=true
characterEncoding=utf8

Data Processing

zeroDateTimeBehavior=convertToNull
tinyInt1isBit=false

Time Zone

serverTimezone=GMT%2B8

Connection

useSSL

For 8.0.12 and earlier: Use SSL when communicating with the server (true/false), default is ‘true’ when connecting to MySQL 5.5.45+, 5.6.26+ or 5.7.6+, otherwise default is ‘false’.

For 8.0.13 and later: Default is ‘true’. DEPRECATED. See sslMode property description for details.

  • Default Value: true
  • Since Version: 3.0.2

autoReconnect

Should the driver try to re-establish stale and/or dead connections

  • Default Value: false
  • Since Version: 1.1

maxReconnects

Maximum number of reconnects to attempt if autoReconnect is true, default is ‘3’.

useSSL=true
autoReconnect=true

Others

Timeout

initialTimeout

If autoReconnect is enabled, the initial time to wait between re-connect attempts (in seconds, defaults to ‘2’).

  • Default Value: 2
  • Since Version: 1.1

connectTimeout

Timeout for socket connect (in milliseconds), with 0 being no timeout. Only works on JDK-1.4 or newer. Defaults to ‘0’.

  • Default Value: 0
  • Since Version: 3.0.1

socketTimeout

Timeout (in milliseconds) on network socket operations (0, the default means no timeout).

  • Default Value: 0
  • Since Version: 3.0.1

References

[1] MySQL Connector/J 8.0 Configuration Properties