hikaricp

How to configure log4j2 to log for HikariCP

半世苍凉 提交于 2019-12-11 03:33:06
问题 I have written a small Gradle project so that I can learn how to configure HikariCP and JDBC and Log4j2 all together in the same project. I have placed the below log4j2 config in the src/main/resources directory in my project. When I execute the project using gradle run I get a warning about not configuring an appender for the com.zaxxer.hikari.HikariConfig logger. Would some one kindly tell me what i am doing wrong? log4j2.xml <?xml version="1.0" encoding="utf-8"?> <Configuration status=

Is there a way to configure Hikari to “fail fast” if the database connection data is invalid?

天涯浪子 提交于 2019-12-11 01:28:32
问题 Running this test with an invalid hostname, or user/password, it waits about 2 minutes before failing. I would ideally like to have it fail immediately if user/password is incorrect, or if the hostname/port are not correct. HikariConfig config = new HikariConfig(); config.setMaximumPoolSize(1); config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource"); config.addDataSourceProperty("serverName", "localhost"); config.addDataSourceProperty("url", "jdbc:mysql://localhost:3306

Apparent connection leak detected with Hikari CP

半世苍凉 提交于 2019-12-10 17:28:11
问题 When using native sql operator IN i get exception. Although it throws an exception, it still works as it was intended, but the exception in the logs is a bit annoying. I think it has something to do with the IN operator. @Query("select c from Contact c where c.id in :ids") List<Contact> findByContactsIds(@Param("ids") List<Integer> contactsIds); config: spring.datasource.hikari.max-lifetime=900000 spring.datasource.hikari.leakDetectionThreshold=2000 spring.datasource.hikari.idle-timeout

Hikaricp Oracle connection issue

泄露秘密 提交于 2019-12-10 16:43:43
问题 I have the following code to get connection to the oracle database. But using hikaricp I am getting the exception. java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL Code: private static HikariDataSource dataSource() { final HikariDataSource hikariDataSource = new HikariDataSource(); hikariDataSource.setMaximumPoolSize(100); hikariDataSource.setMinimumIdle(10); hikariDataSource.setDataSourceClassName("oracle.jdbc.pool.OracleDataSource"); Properties properties = new

Massive number of “SET autocommit=0/1” queries in MySQL

落爺英雄遲暮 提交于 2019-12-10 14:37:58
问题 I'm running some load tests on our system and I notice a massive number of "SET autocommit=0" and "SET autocommit=1" queries being executed. Something around 25,000 within 1 minute. I'm trying to figure out what is causing this and how to get rid of it. We use the following technologies: MySQL Hibernate Hikari Spring Tomcat I have tried the following but it did not seem to help: "SET autocommit = 0" in MySQL Added the elideSetAutoCommits property in the db connection URL. "jdbc:mysql:/

Build HikariCP from source

柔情痞子 提交于 2019-12-10 10:42:31
问题 I want to replace BoneCP with HikariPC . Downloaded tar.gz from here and extracted. I don't know if this is a right command but inside hikaricp-java6 directory I run $ mvn clean compile assembly:single maven prints error [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /Users/gkiko/Downloads/brettwooldridge-HikariCP-5cb1000/hikaricp-java6/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java:[358,20] cannot find symbol symbol : method

HikariCP pass Oracle custom type

若如初见. 提交于 2019-12-10 09:28:52
问题 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

Cloud Foundry Bind services/cups datasource number of connections

末鹿安然 提交于 2019-12-08 12:15:47
问题 I am using hikari with spring boot, local testing I can see 50 active connections. After I deployed to cloud foundry , I am only able to see 10 active connections. spring.datasource.hikari.maximum-pool-size=50 Seems like cloud foundry bind service is trying to overwrite my application's configuration. How can configure this number in cloud foundry? maybe someone get help from this link, it says if you are running serious application in production , you need to configure

Encrypted database password in Play + Slick + HikariCP application

自作多情 提交于 2019-12-08 02:43:19
问题 I'm using play-slick_2.11-1.0.1 + HikariCP 2.4.1 to access SqlServer in my Play4-based application. The database connection in application.conf : slick.dbs.myDatabase = { driver="com.typesafe.slick.driver.ms.SQLServerDriver$" db{ url = "jdbc:sqlserver://sqlserverhost" driver = com.microsoft.sqlserver.jdbc.SQLServerDriver user = "admin" password = "ENCRYPTED_PASSWORD" } } The problem is that the database password configured here must be encrypted based on our company policy. How can I inject

Spring Boot 2.0.X 多数据源及连接池配置

早过忘川 提交于 2019-12-07 11:35:31
一、单数据源 我们在使用Spring Boot配置单数据源的时候很简单,只要在配置文件中加上基本的数据库连接信息和连接池配置信息就可以,通常情况下不需要指定driver-class-name,Spring Boot可以从大多数数据库的url中推断出驱动类型 # 连接配置 spring.datasource.url=jdbc:mysql://localhost:part/test?characterEncoding=utf-8 spring.datasource.username=**** spring.datasource.password=**** spring.datasource.driver-class-name=com.mysql.jdbc.Driver # 连接池配置 spring.datasource.hikari.pool-name=HikariPool spring.datasource.hikari.minimum-idle=5 spring.datasource.hikari.maximum-pool-size=10 spring.datasource.hikari.connection-timeout=30000 spring.datasource.hikari.idle-timeout=600000 spring.datasource.hikari.max