2

I would like to know what is the type of value which we need to pass in public void setQueryTimeout(int queryTimeout) in jdbcTemplate. The document says

> Set the query timeout for statements that this JdbcTemplate executes.
> <p>Default is -1, indicating to use the JDBC driver's default (i.e. to
> not pass a specific query timeout setting on the driver). <p>Note: Any
> timeout specified here will be overridden by the remaining transaction
> timeout when executing within a transaction that has a timeout
> specified at the transaction level. @see
> java.sql.Statement#setQueryTimeout

Like to know if queryTimeout is milliseconds, seconds or minutes

Hassam Abdelillah
  • 2,246
  • 3
  • 16
  • 37
Alex Man
  • 4,746
  • 17
  • 93
  • 178
  • it is strange how it doesnt specify whether it is seconds or milliseconds. You have to base on people's solutions on the internet. :) – Young Emil Oct 21 '20 at 06:42
  • @Young Emil ` Statement.setQueryTimeout` mentions the unit of input param – mantri Nov 19 '21 at 07:07
  • @mantri, I think the question targets `JdbcTemplate.setQueryTimeout` and not that of `Statement` class. – Young Emil Nov 19 '21 at 08:48

1 Answers1

5

After checking the similar setQueryTimeout() from java.sql.Statement class, my guess is that they behave the same.

setQueryTimeout(int seconds)

A good way to start with similar issues is to check a working example on the internet. It helps a lot!

Hassam Abdelillah
  • 2,246
  • 3
  • 16
  • 37
  • I voted up this answer because the function exist and I was able to code it with no errors. However, after implementation, it doesn't seem to timeout after the period. – Young Emil Nov 19 '21 at 08:51