hikaricp

Best approach for returning connection objects to HikariCP pool

落爺英雄遲暮 提交于 2019-12-03 11:16:31
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 additional connection objects being created to meet the requirements of the connection pool size? Looking

Does max connection pool also limits max connections to database?

这一生的挚爱 提交于 2019-12-03 10:14:58
I am using hikari cp with spring boot app which has more that 1000 concurrent users. I have set the max pool size- spring.datasource.hikari.maximum-pool-size=300 When i look at the processlist of mysql using show processlist; It shows max 300 which is equal to the pool size.It never increases than max pool.Is this intened? I thought pool size means connections maintained so that the connections can be reused when future requests to the database are required but when need comes more connections can be made. Also when I am removing the max pool config ,I immediately get- HikariPool-0 -

HikariCP with PostgreSQL: setQueryTimeout(int) is not yet implemented

末鹿安然 提交于 2019-12-02 12:39:53
问题 I tried to use HikariCP with PostgreSQL but it doesn't work. It throws an exception: WARN [2014-10-24 14:38:54,195] com.zaxxer.hikari.pool.HikariPool: Exception during keep alive check, that means the connection must be dead. ! org.postgresql.util.PSQLException: Method org.postgresql.jdbc4.Jdbc4Statement.setQueryTimeout(int) is not yet implemented. ! at org.postgresql.Driver.notImplemented(Driver.java:753) ~[postgresql-9.0-801.jdbc4.jar:na] ! at org.postgresql.jdbc2.AbstractJdbc2Statement

HikariCP Wrapper (thread safety)

眉间皱痕 提交于 2019-12-02 11:33:39
I'm learning to use HikariCP (i'm new in java) and i found a wrapper but i think it's not thread safety, well the instance of the singleton is thread safety but not the method getConnection(). The class is this: public class HikariCPWrapper{ private static final HikariCPWrapper INSTANCE; private HikariDataSource ds; static { INSTANCE = new HikariCPWrapper(); } private HikariCPWrapper(){ HikariConfig config = new HikariConfig(); //config.set... //... ds = new HikariDataSource(config); } public static HikariCPWrapper getInstance () { return INSTANCE; } public Connection getConnection() throws

Hikari connection pooling + Hibernate 4.3.8 + Spring Data JPA configuration?

杀马特。学长 韩版系。学妹 提交于 2019-12-02 11:20:28
please tell me. How can I configure the "Hikari connection pooling + Hibernate 4.3.8 + Spring Data JPA configuration"? Here is my configuration, but for some reason I am sure that this configuration is not correct. Because the the console does not appear anything like the "connetction pooling". On the Internet I can not find the tutorial for the beginner. Thanks. <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" p:dataSource-ref="dataSource" p:packagesToScan="com.history" p:jpaVendorAdapter-ref="jpaVendorAdapter"> <property name=

how to check HikariCP connection pooling is working or not in Java?

≯℡__Kan透↙ 提交于 2019-12-01 15:18:05
I have written following properties in my configuration files I am using Log4j in my application When I am running a project. I am getting following message.does that mean connection pooling is configured in my project? if not then how it will be? INFO: internal.ConnectionProviderInitiator - HHH000130: Instantiating explicit connection provider: com.zaxxer.hikari.hibernate.HikariConnectionProvider I have referred following link also link here Datasource settings hibernate.datasource.driver-class-name=com.mysql.jdbc.Driver hibernate.datasource.url=jdbc:mysql://localhost:3306/mydb hibernate

How to configure Hikari CP for HSQL in a Spring(4) context?

爱⌒轻易说出口 提交于 2019-12-01 10:59:32
i want to use Hikari CP in my Spring 4.0.3 context but seems i am missing something. My bean configuration looks like: <bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource"> <constructor-arg> <bean class="com.zaxxer.hikari.HikariConfig"> <constructor-arg> <props> <prop key="dataSource.driverClassName">${database.driver}</prop> <prop key="dataSource.jdbcUrl">${database.database.jdbc.url}</prop> <prop key="dataSource.port">${database.port}</prop> <prop key="dataSource.databaseName">${database.name}</prop> <prop key="dataSource.user">${database.user}</prop> <prop key="dataSource

Database connection pool[Hikari] initialize error

元气小坏坏 提交于 2019-12-01 05:27:35
问题 I am trying to configure HikariCP for my web application. I am not using any frameworks, it is a plain simple java web app. When I tried to establish a connection through normal JDBC it was successful and I was able to perform all database operations. However, when I am trying to get a connection with a connection pool, I get an exception after initialization which I have no clue about. Below is the config that I am using, I am initializing it in a context listener. I am running on Java 1.7,

Tomcat: HikariCP issue when deploying two applications with DB connection

痞子三分冷 提交于 2019-12-01 04:23:39
I am trying to deploye two WAR files (app1.war and app2.war) on the same tomcat7 instance. I am getting this error : Unable to register MBean [HikariDataSource (HikariPool-0)] with key 'dataSource'; nested exception is javax.management.InstanceAlreadyExistsException: com.zaxxer.hikari:name=dataSource,type=HikariDataSource I don't have this error if I have only one application deployed on tomcat. Is there a way to solve this issue? in spring boot, jmx bean is loaded at run time and it scans your application. If two data sources are found, its going to throw javax.management

HikariPool-1 - Connection is not available, request timed out after 30000ms for very tiny load server

戏子无情 提交于 2019-12-01 02:20:21
I have a small Java application for testing purposes. I have moved to hikari recently. What I notice is that I keep getting this error. java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms. java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms. at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:602) at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:195) at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:145)