Seeking help again...
I have a query that I run, when I run it in Netbeans it's very fast (less than a second) and about a second to display the info. When I run the same query and populate a JTable (defined at design time, not runtime), it is very slow.
DB has about 600 records - delay of 20 seconds Limit to 10 - delay of about 10 seconds Limit to 1 - delay of about 3 seconds
Is there a way to make the Tablemodel "quicker"?
I have contemplated paging, but even a delay of 10 seconds for about 10 records is not great - something must be inherently wrong with my code (sorry, complete Java Noob).
Below is my code:
String SQL = "SELECT RecTable.ipkRecNo, RecTable.RecName order by ipkRecNo";
DefaultTableModel defaultModel = (DefaultTableModel) jTable1.getModel();
Statement stmt = con.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stmt.executeQuery( SQL );
int i = 0;
String PreviousKey = "";
while ( rs.next( ) ) {
i++;
String MyRecNum = "";
String MyRecName = "";
if (rs.getString(1).trim() == PreviousKey.trim() ) {
} else {
MyRecNum = rs.getString(1);
MyRecName = rs.getString(1);
defaultModel.addRow(new Object[]{MyRecNum,MyRecName}); //1307
}