title: INSERT OPENQUERY timeout
body: <p>I'm trying to execute and insert query to a linked server in SQL Server.</p>
  
  <p>For that I'm using <code>INSERT INTO OPENQUERY</code> statement.</p>
  
  <p>The linked server is an Apache HIVE using Cloudera ODBC Provider.</p>
  
  <p>The insert operation takes around 1 minute in my setup when performed from HIVE client.</p>
  
  <p>However, SQL INSERT always times out after 30 seconds.</p>
  
  <p>I set the Query Timeout parameter to 0 but it seems to be not affecting INSERT statement, however, it is working fine for SELECT statements taking longer time.</p>
  
  <p>Is this a known limitation?
  Is there a way to change the timeout for the insert statement when using <code>OPENQUERY</code>?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I would like to clarify the setup I'm working with.</p>
  
  <pre><code>----------                     ----------------------    ---------------
  | MS SQL | =&gt; Linked Server =&gt; | Hive ODBC Provider | =&gt; | Hive Server |
  ----------                     ----------------------    ---------------
  </code></pre>
  
  <p>In Hive, I have a table called calc_result where I would like to periodically store calculation results from the SQL server. For example, I try to insert using a query like this.</p>
  
  <pre><code>insert openquery(HIVE, 'select timestamp timestamp , tag tag, value value from calc_result')
  values('2019-04-22 11:50:41', 'test',2.0)
  </code></pre>
  
  <p>The insert operation is captured correctly by HIVE server and a MapReduce job starts. However, the job will be killed after 30 seconds due to timeout.</p>
  
  <p>The SQL server will show the below error message.</p>
  
  <blockquote>
    <p>OLE DB provider "MSDASQL" for linked server "HIVE" returned message "[Cloudera][Hardy] (72) Query execution timeout expired.".</p>
  </blockquote>
  
  <p>However, <code>SELECT OPENQUERY</code> works fine and would follow <strong>Query Timeout</strong> settings of the linked server (Which is set to 0 in this case).</p>