Welcome! Please see the About page for a little more info on how this works.

+1 vote
in IO by

We have a SQL query that runs for 300 seconds sometimes. This slows down everything, and we would prefer to stop and throw an error after 30 seconds.

In Java, there is a Statement.setQueryTimeout() function where we can set the timeout to 30 seconds.

What is the best way to set this with our CLojure system?

FYI: We are also using honeysql.

1 Answer

+1 vote

HoneySQL is just a DSL. It doesn't actually run any SQL.

In both clojure.java.jdbc and next.jdbc, you can pass a :timeout option when you run the query and that should be applied as a query timeout to the (prepared) statement that is created behind the scenes.

thanks, I will try that