title: JDBC: Get table names involved in a SQL query
body: <p>Is there any way to know the name of the tables involved in a SQL query executed via JDBC?</p>
  
  <p>For example:</p>
  
  <pre><code>SELECT r.roleId FROM User u, UserRole r where r.userId = u.userId and u.name = "Jonh Smith"
  </code></pre>
  
  <p>I don't want only the result set of this query but the actual table names ("User" and "Role"). I don't care about view names, but if there is no way to get the underlying table used in the view it's not a big problem, but this has to work with nested queries.</p>
  
  <p>As for why I need this information it's because I am making a platform that lets other developers build applications on top of it. In my platform I let other developers register their own queries and I store them in a database. I don't want the developers to have to bother with actually manually registering the table names along with the query itself. So at the time I am executing the query I do not really know what that query is doing.</p>