MySQL :: MySQL Connector/J Developer Guide :: 6.3 Configuration Properties (original) (raw)
The world's most popular open source database
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 aConnection
object.
Configuration properties can be set in one of the following ways:
- Using the
set*()
methods on MySQL implementations ofjava.sql.DataSource
(which is the preferred method when using implementations ofjava.sql.DataSource
):com.mysql.cj.jdbc.MysqlDataSource
com.mysql.cj.jdbc.MysqlConnectionPoolDataSource
- As a key-value pair in the
java.util.Properties
instance passed toDriverManager.getConnection()
orDriver.connect()
- As a JDBC URL parameter in the URL given to
java.sql.DriverManager.getConnection()
,java.sql.Driver.connect()
or the MySQL implementations of thejavax.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, addinguseServerPrepStmts
alone to the URL does not make Connector/J use server-side prepared statements; you need to adduseServerPrepStmts=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 6.1 Authentication Properties
Table 6.2 Connection Properties
Table 6.3 Session Properties
Table 6.5 Security Properties
Table 6.6 Statements Properties
Table 6.7 Prepared Statements Properties
Table 6.8 Result Sets Properties
Table 6.9 Metadata Properties
Table 6.10 BLOB/CLOB processing Properties
Table 6.11 Datetime types processing Properties
Table 6.12 High Availability and Clustering Properties
Table 6.13 Performance Extensions Properties
Table 6.14 Debugging/Profiling Properties
Table 6.15 Exceptions/Warnings Properties
Table 6.18 X Protocol and X DevAPI Properties