hikaricp

Why does Spring Batch use 1 database connection for each thread?

China☆狼群 提交于 2020-01-05 07:38:08
问题 Why does Spring Batch use 1 database connection for each thread? Stack: Java 8 Spring Boot 1.5 Spring Batch 3.0.7 HikariCP 2.7.6 DataSource config: batcdb (postgres) readdb (oracle) writedb (postgres) Each datasource is using HikariCP with default 10 connections each. Spring Batch config: ThreadExecutor-1: core-pool-size: 10 max-pool-size: 10 throttle-limit: 10 Job-1 Config / ThreadPoolTaskExecutor: (pool sizes and throttle limit set via application.yml) @Bean public Step job1Step() { return

Creating custom connection pool in Spring Boot application

本秂侑毒 提交于 2020-01-05 07:10:41
问题 I'm writing a Spring Boot application which connects with Snowflake Data Warehouse and execute SQL queries on it. I have written a Configuration class for configuring Datasource for connecting to Snowflake Data Warehouse as follows: @Configuration @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) public class DBConfig { Logger logger = LoggerFactory.getLogger(DBConfig.class); @Bean JdbcTemplate jdbcTemplate() throws IllegalAccessException, InvocationTargetException,

HikariCP hanging on getConnection

纵然是瞬间 提交于 2020-01-04 05:59:31
问题 I have an application that uses HikariCP for connection pooling against an SQL Server DB using JTDS. If I leave the app running overnight, in the morning the first query will hang with the stack trace below. If I request again then new queries will work OK. Is there a timeout I'm missing that will stop the first query from hanging? It seems to hang for about 10->20 minutes and then it starts working. So after 10->20 minutes the sockRead and hung thread disappears. I think the hung query then

jpa custom connection pool

∥☆過路亽.° 提交于 2020-01-02 07:05:32
问题 I've successfully integrated hibernate in my web app. I was happy with my persistence.xml configuration <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> <persistence-unit name="PU"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider" /> <property name="hibernate.hbm2ddl.auto" value="validate" /> <property name="hibernate.dialect" value="org.hibernate

jpa custom connection pool

我的梦境 提交于 2020-01-02 07:05:28
问题 I've successfully integrated hibernate in my web app. I was happy with my persistence.xml configuration <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> <persistence-unit name="PU"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider" /> <property name="hibernate.hbm2ddl.auto" value="validate" /> <property name="hibernate.dialect" value="org.hibernate

jpa custom connection pool

亡梦爱人 提交于 2020-01-02 07:05:12
问题 I've successfully integrated hibernate in my web app. I was happy with my persistence.xml configuration <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> <persistence-unit name="PU"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider" /> <property name="hibernate.hbm2ddl.auto" value="validate" /> <property name="hibernate.dialect" value="org.hibernate

Error using com.zaxxer.hikari.HikariDataSource

此生再无相见时 提交于 2020-01-02 06:00:13
问题 I'm facing an error integrating HikariCP with Spring's JdbcTemplate. I'm using Spring 3.2.2, HikariCP 2.3.8 and sybase jconn4 version 7.0.0 Spring configuration : <bean id="hikariConfig" class="com.zaxxer.hikari.HikariConfig"> <property name="dataSourceClassName" value="com.sybase.jdbc4.jdbc.SybDataSource" /> <property name="connectionTestQuery" value="SELECT 1" /> <property name="maximumPoolSize" value="100" /> <property name="idleTimeout" value="60000" /> <property name="jdbcUrl" value=

Hikari CP maxLifetime / idleTimeout

妖精的绣舞 提交于 2020-01-02 04:30:09
问题 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

How to use HikariCP in Spring Boot with two datasources in conjunction with Flyway

五迷三道 提交于 2020-01-01 01:41:09
问题 I want to use HikariCP as JDBC connection pool in my Spring boot application. I have two datasources (MySQL database as the primary database and accessing those data through Hibernate and additionally an Oracle database for reading some other data through JDBCTemplate). I set the MySQL datasource as primary bean: @Bean @Primary @ConfigurationProperties("spring.datasource") public DataSourceProperties mySQLDataSourceProperties() { return new DataSourceProperties(); } @Bean @Primary

HikariCP auto reconnect

老子叫甜甜 提交于 2019-12-29 07:11:33
问题 I use jpa+hibernate+hikariCP. Today I got connection closed error. I setted connectionTimeout and ideleTimeout properties(hikari). If in meantime use does not do any operition hikari close the pool connections auto. So that I got closed connection problem. My question how can I set properly hiker(jpa,hibernate) properties so if user comes back after 3-4 hours and try to do some operation hikari auto reconnect to db? is it possible? I use hikari v2.6.1 and hibernate v5.2.8.Final 回答1: This