hikaricp

HikariCP pass Oracle custom type

为君一笑 提交于 2019-12-05 13:45:16
I switched to HikariCP from Oracle default datasource. There is a piece of code where I pass custom Oracle type to a stored parameter, and cast java.sql.Connection to oracle.jdbc.OracleConnection . try(OracleConnection connection = (OracleConnection) dbConnect.getConnection()) { try(CallableStatement callableStatement = connection.prepareCall("{? = call pkg_applications.add_application(?,?,?)}")) { callableStatement.registerOutParameter(1, Types.VARCHAR); callableStatement.setString(2, form.getPolicyNumber()); callableStatement.setString(3, form.getPolicyStart()); Object[][] uploads = new

Why is 'SHOW WARNINGS' query issued here? (JPA/Hibernate/MySQL)

柔情痞子 提交于 2019-12-05 11:10:26
We are refactoring the persistence layer of a Java application from JDBC Template to JPA/Hibernate. I am profiling the SQL statements being issued to the database and I see "SHOW WARNINGS" is issued many, many times. According to JProfiler the "SHOW WARNINGS" is accounting for a considerable amount of 'inherent time'. What could cause SHOW WARNINGS to be issued so frequently? This SHOW WARNINGS was NOT previously issued when using Jdbc Template. Below is the part of our stack relevant to persistence. The only change here is the introduction of JPA/Hibernate. JPA / Hibernate: 4.3.6 MySQL driver

Hikari CP maxLifetime / idleTimeout

旧时模样 提交于 2019-12-05 11:01:16
Hikari CP Version : 2.7.4 This is actually not an issue but some doubts. a) maxLifetime : retires the connection after 30 mins. Will it also create a new connection automatically at the time of killing it or it waits for a new request and then creates a new connectios? considering pool has more than minIdle. b) idleTimeout : it will drop after 10 mins of inactivity? but 10mins is too high. is it ok if i mark it as 10s(10 is min as seen from code) as otherwise there will always be connections higher than min-connections? ALso when does the connetion is mark as idle? The Hikari housekeeper runs

Spring Boot 2. Hikari Connection Pool optimization

末鹿安然 提交于 2019-12-05 05:04:10
I have a SpringBoot app, I was making some performance test in the controller, and I realized that whatever is the first query I put the controller, It take ages compare to the others... (ths DB is a remote connection, but I can't change this) long t1 = System.nanoTime(); menuPriceSummaryService.findAllVegan().stream(); long t2 = System.nanoTime(); long elapsedTimeInSeconds = (t2 - t1) / 1000000000; System.out.println("elapsedTimeInSeconds1 -> " + elapsedTimeInSeconds); t1 = System.nanoTime(); menuPriceSummaryService.findAllVegan(); t2 = System.nanoTime(); elapsedTimeInSeconds = (t2 - t1) /

HikariCP starts when “mvn spring-boot:run” but not with a deployable war file

情到浓时终转凉″ 提交于 2019-12-05 03:36:44
问题 We have a spring boot application. When we do "mvn spring-boot:run", the application uses HikariCP. When we deploy a war file on tomcat, the CP is different and it crashes with connection closed after a few hours. How can I force Hikari when deploying a war file? This is our application.properties: spring.datasource.url=jdbc:mysql://localhost:3306/xxx? autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&connectionCollation=utf8_general_ci&characterSetResults=utf8&autoDeserialize=true

Spring Boot 2 disable Autocommit Hikari with multiple datasources

雨燕双飞 提交于 2019-12-05 02:14:18
问题 I am attempting to turn of auto-commit on Hikari with multiple data sources, but I'm not having any luck. I'm using Spring Boot 2 (2.0.3.RELEASE). Here is my config: application.properties spring.datasource.primary.driver=com.mysql.cj.jdbc.Driver spring.datasource.primary.url=jdbc:mysql://localhost:3306/spark?autoReconnect=true spring.datasource.primary.username=xxxx spring.datasource.primary.password=xxxx spring.datasource.primary.max-active=100 spring.datasource.primary.max-idle=5 spring

Using HikariCP's connection pool the correct way

淺唱寂寞╮ 提交于 2019-12-05 00:30:25
问题 I been trying to develop a Minecraft server plugin where a player enters a command with some data, data is sent to database, or, a command that requests some data from database. It's working, until a user starts using it more then a few times. I get a leakdetection error: [HikariPool-2 housekeeper] WARN com.zaxxer.hikari.pool.ProxyLeakTask - Connection leak detection triggered for com.mysql.jdbc.JDBC4Connection@abc6eb, stack trace follows [23:36:11 WARN]: java.lang.Exception: Apparent

springboot2.1.0.RELEASE 中配置数据源。

怎甘沉沦 提交于 2019-12-04 20:39:32
一、查看当前正在使用的连接池。 通过下面的代码,可以查看当前正在使用的连接池: import org.junit.Test; import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import javax.sql.DataSource; @RunWith(SpringRunner.class) @SpringBootTest public class DataSourceTest { private static final Logger logger = LoggerFactory.getLogger(DataSourceTest.class); @Autowired private DataSource dataSource; @Test public void dataSourceInfo

Hibernate 5 + HikariCP + MySQL

此生再无相见时 提交于 2019-12-04 19:45:18
I've started a project using Hibernate 5 and a MySQL database. Prior to this project, I've been using Hibernate 4, PostgreSQL and C3P0 connection pool. Now, I want to use HikariCP as it seems really promising, with Hibernate 5 . Here it's my IVY configuration part for hibernate: <?xml version="1.0"?> <!DOCTYPE ivy-module [ <!ENTITY vaadin.version "7.5.5"> <!ENTITY highcharts.version "1.1"> <!ENTITY vaadin.charts.version "3.0.0-alpha5"> <!ENTITY hibernate.version "5.0.1.Final"> <!ENTITY mysql.version "5.1.36"> <!ENTITY log4j.version "2.3"> <!ENTITY apache.poi.version "3.12"> <!ENTITY apache

Best approach for returning connection objects to HikariCP pool

好久不见. 提交于 2019-12-04 17:13:55
问题 I am trying to use HikariCP connection pool. I was able to get it to work and get a connection that I could use. I am not sure what is the best approach for returning the connection to the pool. I have the following questions: Should I close the connection when I am done, rely on idleTimeout and maxLifetime settings or is there another call that I can use so as not to hog the connections from the pool? If I close the connections (instead of returning to the pool), would that not result in