title: How to save the results of a query on variables for each field on Java?
body: <p>I need to accomplish the following:</p>
  
  <p>1.- Save on different variables each field of a query result (Oracle DB).<br>
  The query result could be 1 o more rows (5 average).<br>
  2.- Invoke a WebService for each row.<br>
  4.- Wait for the WebService answer and then repeat the process.</p>
  
  <p>I think that saving the result of 1 row and then invoke the WebService it easy but the problem is when the query result throws more than 1 row. <br></p>
  
  <p>How can I do this? Is Arraylist the answer?</p>
  
  <p>EDIT: I am using the following code. How can I print the arraylist to see if the connection is working?
  If I run this i get:</p>
  
  <pre><code>com.packagename.SomeBean@1d251891
  com.packagename.SomeBean@48140564
  com.packagename.SomeBean@58ceff1
  </code></pre>
  
  <p><br></p>
  
  <pre><code>Connection con = null;
  Statement stmt = null;
  ResultSet rs = null;
  
  List&lt;SomeBean&gt; v = new ArrayList&lt;SomeBean&gt;();
  
  String query = "select * from table where ROWNUM BETWEEN 1 and 3";
  
  try 
  {
    Class.forName("oracle.jdbc.driver.OracleDriver");
        con = DriverManager.getConnection("jdbc:oracle:thin:user/pass@localhost:port:SID");
        stmt = con.createStatement();     
        rs = stmt.executeQuery(query);
  
    while( rs.next() ){             
  
      SomeBean n = new SomeBean();
      n.setColumn1(rs.getInt("column1"));
      n.setColumn2(rs.getString("column2"));
      n.setColumn3(rs.getString("column3"));
      n.setColumn4(rs.getInt("column4"));
      n.setColumn5(rs.getString("column5"));
      n.setColumn6(rs.getString("column6"));
      n.setColumn7(rs.getString("column7"));
      ...
      v.add(n);       
      }
  
    for(SomeBean s : v){
      System.out.println(s);
    }
  
  } catch (ClassNotFoundException e) {
        e.printStackTrace();
  } catch (SQLException e) {
      e.printStackTrace();
  } finally {
      try {
          stmt.close();
          con.close();
      } catch (SQLException e) {
          e.printStackTrace();
      }
  }
  </code></pre>