I am creating a Swing program that runs a query on a database, then produces a JTable out of the resultset. When I try to run it, I get stmt pointer is closed in my console. This happens when it reaches the line
JTable table = new JTable(DBTable.buildTableModel(results));
Here is DBTable.buildTableModel():
public class DBTable{
public static DefaultTableModel buildTableModel(ResultSet results)
throws SQLException {
ResultSetMetaData metaData = results.getMetaData();
Vector columnNames = new Vector();
int columnCount = metaData.getColumnCount();
for (int column = 1; column <= columnCount; column++) {
columnNames.add(metaData.getColumnName(column));
}
Vector> data = new Vector>();
while (results.next()) {
Vector
It is this line specifically that causes the issue, and it doesnt make it past it even on the first loop:
columnNames.add(metaData.getColumnName(column));
Can anyone tell me why this is?