Skip to content

Commit a8bb23f

Browse files
committed
update HikariCP version
1 parent f9aefa7 commit a8bb23f

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@
635635
<dependency>
636636
<groupId>com.zaxxer</groupId>
637637
<artifactId>HikariCP</artifactId>
638-
<version>2.7.8</version>
638+
<version>3.1.0</version>
639639
</dependency>
640640
<dependency>
641641
<groupId>org.jooq</groupId>

src/main/java/de/rwth/idsg/steve/config/BeanConfiguration.java

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import com.google.common.util.concurrent.ThreadFactoryBuilder;
44
import com.mysql.cj.core.conf.PropertyDefinitions;
5-
import com.mysql.cj.jdbc.MysqlDataSource;
65
import com.zaxxer.hikari.HikariConfig;
76
import com.zaxxer.hikari.HikariDataSource;
7+
import de.rwth.idsg.steve.SteveConfiguration;
88
import de.rwth.idsg.steve.service.DummyReleaseCheckService;
99
import de.rwth.idsg.steve.service.GithubReleaseCheckService;
1010
import de.rwth.idsg.steve.service.ReleaseCheckService;
@@ -58,24 +58,23 @@ public class BeanConfiguration implements WebMvcConfigurer {
5858
* https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration
5959
*/
6060
private void initDataSource() {
61-
MysqlDataSource ds = new MysqlDataSource();
61+
SteveConfiguration.DB dbConfig = CONFIG.getDb();
62+
63+
HikariConfig hc = new HikariConfig();
6264

6365
// set standard params
64-
ds.setServerName(CONFIG.getDb().getIp());
65-
ds.setPort(CONFIG.getDb().getPort());
66-
ds.setDatabaseName(CONFIG.getDb().getSchema());
67-
ds.setUser(CONFIG.getDb().getUserName());
68-
ds.setPassword(CONFIG.getDb().getPassword());
66+
hc.setJdbcUrl("jdbc:mysql://" + dbConfig.getIp() + ":" + dbConfig.getPort() + "/" + dbConfig.getSchema());
67+
hc.setUsername(dbConfig.getUserName());
68+
hc.setPassword(dbConfig.getPassword());
6969

7070
// set non-standard params
71-
ds.getModifiableProperty(PropertyDefinitions.PNAME_cachePrepStmts).setValue(true);
72-
ds.getModifiableProperty(PropertyDefinitions.PNAME_prepStmtCacheSize).setValue(250);
73-
ds.getModifiableProperty(PropertyDefinitions.PNAME_prepStmtCacheSqlLimit).setValue(2048);
74-
ds.getModifiableProperty(PropertyDefinitions.PNAME_characterEncoding).setValue("utf8");
75-
ds.getModifiableProperty(PropertyDefinitions.PNAME_serverTimezone).setValue(CONFIG.getTimeZoneId());
76-
77-
HikariConfig hc = new HikariConfig();
78-
hc.setDataSource(ds);
71+
hc.addDataSourceProperty(PropertyDefinitions.PNAME_cachePrepStmts, true);
72+
hc.addDataSourceProperty(PropertyDefinitions.PNAME_useServerPrepStmts, true);
73+
hc.addDataSourceProperty(PropertyDefinitions.PNAME_prepStmtCacheSize, 250);
74+
hc.addDataSourceProperty(PropertyDefinitions.PNAME_prepStmtCacheSqlLimit, 2048);
75+
hc.addDataSourceProperty(PropertyDefinitions.PNAME_characterEncoding, "utf8");
76+
hc.addDataSourceProperty(PropertyDefinitions.PNAME_serverTimezone, CONFIG.getTimeZoneId());
77+
hc.addDataSourceProperty(PropertyDefinitions.PNAME_useSSL, true);
7978

8079
dataSource = new HikariDataSource(hc);
8180
}

0 commit comments

Comments
 (0)