title: How can I generically detect if a database is 'empty' from Java
body: <p>Can anyone suggest a good way of detecting if a database is empty from Java (needs to support at least Microsoft SQL Server, Derby and Oracle)?</p>
  
  <p>By empty I mean in the state it would be if the database were freshly created with a new create database statement, though the check need not be 100% perfect if covers 99% of cases.</p>
  
  <p>My first thought was to do something like this...</p>
  
  <pre><code>tables = metadata.getTables(null, null, null, null);
  Boolean isEmpty = !tables.next();
  return isEmpty;
  </code></pre>
  
  <p>...but unfortunately that gives me a bunch of underlying system tables (at least in Microsoft SQL Server).</p>