1) Is it possible to set up global value of queryTimout for Dropwizard's JDBI mysql connector? What is the default value? I dont want to use @QueryTimeOut in every single DAO.
2) And what about java.sql.Statement.Connection where is networkTimeout parameter, which is defined as:
number of milliseconds the driver will wait for a database request to complete. If the limit is exceeded, a SQLException is thrown.
Should I consider that as a query timeout?
You can configure a statement consumer that would inject it for every single statement. It can be set on the configurable JDBC wrapper: org.jdbi.v3.core.Jdbi Something like:
Jdbi.create(datasource)
.configure(SqlStatements.class, stmt -> {
stmt.setQueryTimeout(timeout);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With