Skip to content

Commit

Permalink
Support 'mysql8` adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
tomekw authored and jstepien committed Jul 20, 2020
1 parent f093a00 commit 0e7d285
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,6 +1,7 @@
## unreleased

* set Clojure 1.9.0 as a provided dependency
* support `mysql8` adapter (sets datasource class name to `com.mysql.cj.jdbc.MysqlDataSource`)

## 2.12.0

Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -83,6 +83,7 @@ Custom translations of properties can be added by extending the
| `hsqldb` | `org.hsqldb.jdbc.JDBCDataSource` | No |
| `mariadb` | `org.mariadb.jdbc.MySQLDataSource` | No |
| `mysql` | `com.mysql.jdbc.jdbc2.optional.MysqlDataSource` | **Yes** |
| `mysql8` | `com.mysql.cj.jdbc.MysqlDataSource` | No |
| `neo4j` | `org.neo4j.jdbc.DataSource` | No |
| `sqlserver-jtds` | `net.sourceforge.jtds.jdbcx.JtdsDataSource` | **Yes** |
| `sqlserver` | `com.microsoft.sqlserver.jdbc.SQLServerDataSource` | **Yes** |
Expand Down
1 change: 1 addition & 0 deletions src/hikari_cp/core.clj
Expand Up @@ -24,6 +24,7 @@
"hsqldb" "org.hsqldb.jdbc.JDBCDataSource"
"mariadb" "org.mariadb.jdbc.MySQLDataSource"
"mysql" "com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
"mysql8" "com.mysql.cj.jdbc.MysqlDataSource"
"neo4j" "org.neo4j.jdbc.DataSource"
"sqlserver-jtds" "net.sourceforge.jtds.jdbcx.JtdsDataSource"
"sqlserver" "com.microsoft.sqlserver.jdbc.SQLServerDataSource"
Expand Down
8 changes: 6 additions & 2 deletions test/hikari_cp/core_test.clj
Expand Up @@ -58,10 +58,12 @@
(datasource-config (-> (dissoc valid-options :adapter)
(merge alternate-valid-options2))))

(def mysql8-datasource-config
(datasource-config (merge valid-options {:adapter "mysql8"})))

(def mysql-datasource-config
(datasource-config (merge valid-options
{:adapter "mysql"
:datasource-class-name "com.mysql.cj.jdbc.MysqlDataSource"
:use-legacy-datetime-code false})))

(def metric-registry-config (datasource-config (merge valid-options metric-registry-options)))
Expand All @@ -72,8 +74,10 @@

(expect false
(get (.getDataSourceProperties mysql-datasource-config) "useLegacyDatetimeCode"))
(expect "com.mysql.cj.jdbc.MysqlDataSource"
(expect "com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
(.getDataSourceClassName mysql-datasource-config))
(expect "com.mysql.cj.jdbc.MysqlDataSource"
(.getDataSourceClassName mysql8-datasource-config))
(expect true
(.isAutoCommit datasource-config-with-required-settings))
(expect false
Expand Down

0 comments on commit 0e7d285

Please sign in to comment.