title: In DBeaver, how can I run an SQL union query from two different connections..?
body: <p>We recently migrated a large DB2 database to a new server. It got trimmed a lot in the migration, for instance 10 years of data chopped down to 3, to name a few. But now I find that I need certain data from the old server until after tax season.</p>
  
  <p>How can I run a <code>UNION</code> query in DBeaver that pulls data from two different connections..? What's the proper syntax of the table identifiers in the <code>FROM</code> and <code>JOIN</code> keywords..?</p>
  
  <p>I use DBeaver for my regular SQL work, and I cannot determine how to span a <code>UNION</code> query across two different connections. However, I also use Microsoft Access, and I easily did it there with two Pass-Through queries that are fed to a native Microsoft Access union query.</p>
  
  <p>But how to do it in DBeaver..? I can't understand how to use two connections at the same time.</p>
  
  <p>For instance, here are my connections:</p>
  
  <p><a href="https://i.stack.imgur.com/NbZLR.png" rel="noreferrer"><img src="https://i.stack.imgur.com/NbZLR.png" alt="enter image description here"></a></p>
  
  <p>And I need something like this...</p>
  
  <pre><code>SELECT      *
  FROM        ASP7.F_CERTOB.LDHIST 
  UNION
  SELECT      *
  FROM        OLD.VIPDTAB.LDHIST 
  </code></pre>
  
  <p>...but I get the following error, to which I say "No kidding! That's what I want!", lol... =-)</p>
  
  <pre><code>SQL Error [56023]: [SQL0512] Statement references objects in multiple databases.
  </code></pre>
  
  <p>How can this be done..?</p>