how to print a resultset in a jtable..

I have retreived the data set and I want it to desplay in a table as it is in the database. How can i achieve it?


Read the result into a two-dimensional array and then use

((DefaultTableModel) jTable.getModel()).setDataVector(<2darray>, <columnNames>);

Edit: P.S. Since you cannot, reliably, know, beforehand (without some futzing around), how many rows the resultset contains read it into a List<String[]> and then use List's toArray method to get the List as an array.