@ -76,25 +76,19 @@ This is the name of the ``DataSource`` class provided by the JDBC driver. Consu
documentation for your specific JDBC driver to get this class name, or see the [table](https://github.com/brettwooldridge/HikariCP#popular-datasource-class-names) below.
documentation for your specific JDBC driver to get this class name, or see the [table](https://github.com/brettwooldridge/HikariCP#popular-datasource-class-names) below.
Note XA data sources are not supported. XA requires a real transaction manager like
Note XA data sources are not supported. XA requires a real transaction manager like
[bitronix](https://github.com/bitronix/btm). Note that you do not need this property if you are using
[bitronix](https://github.com/bitronix/btm). Note that you do not need this property if you are using
``driverClassName`` to wrap an old-school DriverManager-based JDBC driver. The HikariCP team
``jdbcUrl`` for "old-school" DriverManager-based JDBC driver configuration. The HikariCP team
considers ``dataSourceClassName`` to be a superior method of creating connections compared to
considers ``dataSourceClassName`` to be a superior method of creating connections compared to
``driverClassName``. *Default: none*
``jdbcUrl``, *but in the end either is fine*. *Default: none*
:abc:``driverClassName``<br/>
*or*
This property allows HikariCP to wrap an old-school JDBC driver as a ``javax.sql.DataSource``.
It is unnecessary when using the ``dataSourceClassName`` property, which is the preferred way
of creating connections in HikariCP. DataSources are provided by all but the oldest JDBC drivers.
If ``driverClassName`` is used, then the ``jdbcUrl`` property must also be set. *Default: none*
:abc:``jdbcUrl``<br/>
:abc:``jdbcUrl``<br/>
This property is only used when the ``driverClassName`` property is used to wrap an old-school
This property directs HikariCP to use "DriverManager-based" configuration. We feel that DataSource-based
JDBC driver as a ``javax.sql.DataSource``. While JBDC URLs are popular, HikariCP does not
configuration is superior for a variety of reasons (see below), but for many deployments there is
recommend using them. The *DataSource* implementation provided by your driver provides bean
little significant difference. When using this property with "old" drivers, you may also need to set
properties for all the driver parameters that used to be specified in the JDBC URL. Before using
the ``driverClassName`` property, but try it first without. Note that if this property is used, you may
the ``jdbcUrl`` and ``driverClassName`` because that's the way you've always done it, consider
still use *DataSource* properties to configure your driver and is in fact recommended over driver parameters
using the more modern and maintainable ``dataSourceClassName`` approach instead. Note that if
specified in the URL itself. *Default: none*
this property is used, you may still use *DataSource* properties to configure your driver and
is in fact recommended. *Default: none*
##### Frequently used
##### Frequently used
@ -122,18 +116,12 @@ recommend setting this value, and using something reasonable like 30 minutes or
value of 0 indicates no maximum lifetime (infinite lifetime), subject of course to the
value of 0 indicates no maximum lifetime (infinite lifetime), subject of course to the
@ -313,11 +306,8 @@ There is also a System property available, ``hikaricp.configurationFile``, that
location of a properties file. If you intend to use this option, construct a ``HikariConfig`` or ``HikariDataSource``
location of a properties file. If you intend to use this option, construct a ``HikariConfig`` or ``HikariDataSource``
instance using the default constructor and the properties file will be loaded.
instance using the default constructor and the properties file will be loaded.
#### HikariConfig vs. HikariDataSource
The advantage of configuring via ``HikariConfig`` over ``HikariDataSource`` is that when using the ``HikariConfig`` we know at ``DataSource`` construction-time what the configuration is, so the pool can be initialized at that point. However, when using ``HikariDataSource`` alone, we don't know that you are *done* configuring the DataSource until ``getConnection()`` is called. In that case, ``getConnection()`` must perform an additional check to see if the pool has been initialized yet or not. The cost (albeit small) of this check is incurred on every invocation of ``getConnection()`` in that case.
### Popular DataSource Class Names
### Popular DataSource Class Names
We recommended using ``dataSourceClassName`` instead of ``driverClassName``/``jdbcUrl``, *but both are acceptable*. *Note: Spring Boot auto-configuration users, you need to use ``driverClassName``/``jdbcUrl``-based configuration.*
We recommended using ``dataSourceClassName`` instead of ``jdbcUrl``, but both are acceptable. We'll say that again, *both are acceptable*. *Note: Spring Boot auto-configuration users, you need to use ``jdbcUrl``-based configuration.*
Here is a list of JDBC *DataSource* classes for popular databases:
Here is a list of JDBC *DataSource* classes for popular databases: