title: How do I turn a Java SQL query into a Java Object [][]?
body: <p>I'm looking for a way to query a SQL database with Java and return an Object [][]. Here is the SQL query:</p>
  
  <pre><code> private static Object result[][] = null;
   result = run.query(conn, "select * from TREEDATA", rsh);
  </code></pre>
  
  <p>Here is the sample of what the data should mirror:</p>
  
  <pre><code>    Object[][] table = {
          {1, null, "Root"}, //i=0
          {2, 1, "Node2"}, //i=1
          {3, 2, "Node3"}, //i=2
          {4, 3, "Node4"}, //i=3
          {5, 4, "Node5"}, //i=4
          {6, 5, "Node6"}, //i=5
          {7, 6, "Node7"}, //i=6
          {8, 1, "Node8"}, //i=7
          {9, 1, "Node9"}, //i=8
          {10, 9, "Node10"},};    //i=9
  </code></pre>
  
  <p>Here is the result set handler with the code that I cannot figure out:</p>
  
  <pre><code>    public Object[][] handle(ResultSet rs) throws SQLException {
          if (!rs.next()) {
              System.out.println("result set is null");
              return null;
          }
          ResultSetMetaData meta = rs.getMetaData();
          int rows = 0;
          while (rs.next()) {
              rows++;
          }
          Object[][] result = new Object[rows];
          int i = 0;
          while (rs.next()) {
   //How do I do what I need to do in order to return result[][] 
              result[i][] = rs.getObject(3);           
              System.out.println(result[i][2].toString());
          }
          return result;
  }
  </code></pre>