-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How does hikariCP actively disconnect #2230
Comments
@Caesar2816 you need to setup socket timeout property on jdbc driver properties, i.e:
Postgreshttps://jdbc.postgresql.org/documentation/use/
MariaDBhttps://mariadb.com/docs/server/connect/programming-languages/java/connect/
JDBCOr, you can set it directly on the prepared statement:
|
Sorry for forgetting to mark the ORACLE database I used The following methods have now been tested The second kind: custom datasouce to set the timeout time is not good |
So what do you use, mybatis or jdbc template? Both?
As far as I know, there is no equivalent of socketTimeout in Oracle. Anyway, HikariCP will not manage cancelation for you, you need to investigate what Oracle can do there. Even if you close the connection from the client, the server will keep it for some time, so you need to adjust |
I am using mybatis because considering that the underlying is calling JDBC, so adding JDBC configuration to do the test result is not effective |
It's not JDBC configuration, it's JdbcTemplate which is kind of "ORM". Current statement:
Original statement:
So seems you don't need to stop active queries, instead you just want to not have any idle connections to database which is
|
This treatment did not meet my expectations |
So for SQL execution time you need to set queryTimeout property on prepared statement, which out of control of hikari, consult your jdbc driver documentation, database documentation and ORM documentation on this topic. |
Yes, HikariCP does have no control over the timeout duration |
How does hikariCP set the SQL timeout period to ensure that the global SQL automatically disconnects the connection after 30 seconds of execution, so that the connection is not full because the connection is not released while holding the connection
The following configurations cannot be actively disconnected after testing, but will continue to perform:
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.validation-timeout=30000
The text was updated successfully, but these errors were encountered: