JDBC format ResultSet as tabular string?
<p>When I query a database in the MySQL command-line interface I get some nice prettified tabular output:</p>

<pre class="lang-none prettyprint-override"><code>mysql&gt; select * from users;
+------------+--------------------------------------+------------+
| IGN        | UUID                                 | AdminLevel |
+------------+--------------------------------------+------------+
| GamerBoy   | 0fcba4a5-f039-4771-ae22-bf203ed89c1c |          3 |
+------------+--------------------------------------+------------+
</code></pre>

<p>Now, in java I have to use a <code>ResultSet</code> to store the result of a query, and here is the code I currently have:</p>

<pre class="lang-java prettyprint-override"><code>String query = String.join(" ", Arrays.copyOfRange(args, 2, args.length));
System.out.println("Querying the database with: " + query);
try {
  Statement stmt = dbConnection.createStatement();
  ResultSet rs = stmt.executeQuery(query);
  System.out.println("Query parsed successfully!");
  /* What need to go here? I want to output the result of the query
   * in the same way that the MySQL tool would - some prettified String.
   */
} catch (SQLException exception) {
  System.out.println("Query failed: " + exception.getMessage()) ;
}
</code></pre>

<p>How do I get a string containing the sort of output that MySQL would give me?</p>

<hr>

<p>Basically, I want to make a java program which can query a database - the query can be different every time, it is user-chosen - and then outputs the result of the query in the neat tabular format that MySQL uses.</p>

<p>How can I do this?</p>