4

How can I add timeout for hive jdbc connection. When ever hive hangs, my application waiting for responses from hive. What I need is, after some specified time(may be in minutes), my application needs to stop listening from hive connection, do the rest of the work.

1 Answers1

0

Use this property in your hive configuration file.

<property>
  <name>hive.stats.jdbc.timeout</name>
  <value>30</value>
  <description>Timeout value (number of seconds) used by JDBC connection and statements.</description>
</property>

This will be used in login timeout and query timeout. If your query takes more than 30 seconds or configured seconds it will return.

shazin
  • 21,379
  • 3
  • 54
  • 71
  • 2
    Don’t be fooled, that only for the `stats` package not for the client side jdbc driver. –  Feb 21 '13 at 12:57
  • 1
    The info that it only applies to the stats package has been mentioned in a [hive-user email group post](http://mail-archives.apache.org/mod_mbox/hive-user/201302.mbox/%3CFF1DF58D04F11D4291D09795D1A4EF1618657D12FC@SRV-MAIL%3E). It also mentions that (as of 2013-02-06) the natural place to do it - `Statement.setQueryTimeout` - is not implemented yet. – Jakub Holý Jul 29 '13 at 12:10