Hi I think you are trying to do too much inside the one while loop. Have a look at the following code excerpt, which comes directly from "Java How To Program (Third Edition)" by Deitel & Deitel: <code> private void displayResultSet( ResultSet rs ) throws SQLException { // position to first record boolean moreRecords = rs.next(); // If there are no records, display a message if ( ! moreRecords ) { JOptionPane.showMessageDialog( this, "ResultSet contained no records" ); setTitle( "No records to display" ); return; } setTitle( "Authors table from Books" ); Vector columnHeads = new Vector(); Vector rows = new Vector(); try { // get column heads ResultSetMetaData rsmd = rs.getMetaData();