I want to fetch a table from a database using Java code. The sample code which I tried gets only two columns. I want the fetched data to be presented exactly like it is in the table. How do I do that ?
This code only gives me two rows, side by side -
while (rs.next()) {
System.out.println(rs.getString(4) + " " + rs.getString(6));
}
Full example at -
http://msdn.microsoft.com/en-us/library/aa342339.aspx
This is what I tried - 
         int size = 0;
         if(rs != null){
            rs.beforeFirst();  
            rs.last();  
            size = rs.getRow();  
         }
         System.out.println("cols = " + size);
And got an error - The requested operation is not supported on forward only result sets.
 
     
     
     
    