I am really angry with myself that I have to ask this question, I have googled it for two days now and have found hundreds of people asking this same question, yet I still cant identify how to make it work.

I found this DbUtil that converts my SQL data into a jtable just fine. But when I try to add a row it will not update in real time. If I was working with a simple tablemodel this would be very simple, I would just need to run the firetabledatachanged function... But using this DbUtils I am not getting the option to do the firetabledatachanged function...

package simpledatabase;
 
public class Query extends JFrame {
 
	private static final long serialVersionUID = 1L;
	public static final String JDBC_URL = "jdbc:derby:zadb;create=true";
	private JPanel contentPane;
	private JTable table;
	private JButton btnAddRow;
	private JMenuBar menuBar;
	private JMenu mnProgram;
	private JMenuItem mntmGenerateInvoice;
	private JMenuItem mntmCloseProgram;
	private JSeparator separator;
 
 
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Query frame = new Query();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}
 
	public Query() throws SQLException {
 
		Connection connection = DriverManager.getConnection(JDBC_URL);
		final Statement statement = connection.createStatement();
		final ResultSet resultset = statement.executeQuery("select * from table1");
		connection.setAutoCommit(false);
 
 
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 700, 350);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
 
		JScrollPane scrollPane = new JScrollPane();
		contentPane.add(scrollPane, BorderLayout.CENTER);
 
		table = new JTable (DbUtils.resultSetToTableModel(resultset));
		scrollPane.setViewportView(table);
 
		btnAddRow = new JButton("Add Row");
		btnAddRow.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				try {
					statement.executeUpdate("insert into table1 values " +"(null,null,null,null) ");
				} catch (SQLException e1) {
					e1.printStackTrace();
				}
		table.setModel(DbUtils.resultSetToTableModel(resultset)); // This does not work.... How do I get the jtable to update in real time? ********************************
 
			}
		});
		contentPane.add(btnAddRow, BorderLayout.SOUTH);
 
		menuBar = new JMenuBar();
		contentPane.add(menuBar, BorderLayout.NORTH);
 
		mnProgram = new JMenu("Program");
		menuBar.add(mnProgram);
 
		mntmGenerateInvoice = new JMenuItem("Generate Invoice");
		mnProgram.add(mntmGenerateInvoice);
 
		separator = new JSeparator();
		mnProgram.add(separator);
 
		mntmCloseProgram = new JMenuItem("Close Program");
		mnProgram.add(mntmCloseProgram);
	}
 
}