what is different between HikariCP & HikariCP-java7

1,054 views
Skip to first unread message

Rocky Wang

unread,
Oct 17, 2017, 9:41:40 PM10/17/17
to HikariCP
i am using hikariCP with jdk 7 first time  (with gradle)


i see need to use   
    "<artifactId>HikariCP-java7</artifactId>
   <version>2.4.13</version>"

but error occur, i still need to add HikariCP not only HikariCP-java7

what's different this two ?



another question, i using jdk 8 with HikariCP 2.7.2, 
when i assign  "dataSourceClassName: com.mysql.jdbc.jdbc2.optional.MysqlDataSource"  in my application.yml file
cannot find this class occur
but when i don't assign
Driver does not support get/set network timeout for connections. (com.mysql.jdbc.JDBC4Connection.getNetworkTimeout()I)   appear

does this mean when connection is not avaiable and fail immediately without wait to get connection ?
how can i let it wait to get connection ?


Brett Wooldridge

unread,
Oct 18, 2017, 2:06:15 AM10/18/17
to hika...@googlegroups.com
What error are you getting regarding HikariCP-java7?  That should be the only dependency you need (i.e. you do not need HikariCP, which is Java 8+ only).

If you are using application.yml does that imply that you are using Spring Boot?  As far as I know, Spring Boot does not support specifying a DataSource class name, only a driver.

If you are getting the "Driver does not support get/set network timeout for connections." for MySQL, that indicates to me that you are using a very old MySQL driver.  Please update.  However, what the message indicates is that HikariCP will not be able to protect against network partition events -- i.e. when the network between the application and MySQL goes down.  Typically, when this occurs, an attempt to validate a connection will hang in the OS-layer due to unacknowledged TCP packets.  When this occurs, the TCP connection can be "stuck" for however long the OS timeout is (typically hours).  If the driver supports get/setNetworkTimeout(), HikariCP can protect against this case.  Newer MySQL drivers do support get/setNetworkTimeout().

This timeout has no effect on how long a call to getConnection() will wait -- except in the case of a network partition event and a driver that does not support get/setNetworkTimeout().

-Brett

Rocky Wang

unread,
Oct 18, 2017, 5:29:42 AM10/18/17
to hika...@googlegroups.com
thanks for answer very much

the first question, i remove HikariCP, just keep HikariCP-java7, i works !!

the second question, i change my gradle configuration to newer mysql connector version

like above, from 5.1.14 change to 5.1.44, it solved, that message not appeard !   

    //compile "mysql:mysql-connector-java:5.1.14"
    
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.44'

thank you   :)



This timeout has no effect on how long a call to getConnection() will wait.  Even in the case of a network partition event, and a driver that does not support get/setNetworkTimeout(), HikariCP will still honor whatever connectionTimeout you specify before throwing a timeout exception.

-Brett

--
You received this message because you are subscribed to a topic in the Google Groups "HikariCP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hikari-cp/qIwid6ZCpGc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hikari-cp+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hikari-cp.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages