title: Get Array From List Of Rows?
body: <p>I was curious on how to get a list of rows and add values from each row to an array in Java.</p>
  
  <p>Here is what it looks like in PHP:</p>
  
  <pre><code>&lt;?php
  $result = mysql_query("SELECT * FROM names");
  while($row = mysql_fetch_array($result)) {
  // Get variables from this row and such
  }
  ?&gt;
  </code></pre>
  
  <p>I can't seem to find out how to do this in Java.</p>
  
  <h2>Resolution Found</h2>
  
  <pre><code>Statement sta = con.createStatement(); 
  ResultSet res = sta.executeQuery("SELECT TOP 10 * FROM SalesLT.Customer");
  while (res.next()) {
      String firstName = res.getString("FirstName");
      String lastName = res.getString("LastName");
      System.out.println("   " + firstName + " " + lastName);
  }
  </code></pre>