title: Print the data in ResultSet along with column names
body: <p>I am retrieving columns names from a SQL database through Java. I know I can retrieve columns names from <code>ResultSet</code> too. So I have this sql query </p>
  
  <pre><code> select column_name from information_schema.columns where table_name='suppliers'
  </code></pre>
  
  <p>The problem is I don't know how can I get columns names from <code>ResultSet</code> and my code is</p>
  
  <pre><code>public void getAllColumnNames() throws Exception{
  
  String sql = "SELECT column_name from information_schema.columns where table_name='suppliers'";
  
  PreparedStatement ps = connection.prepareStatement(sql);
  ResultSet rs = ps.executeQuery(sql);
   // extract values from rs
  
  
  }
  </code></pre>