initComponents();
try {
ResultSet res = statement.executeQuery(\"SELECT * FROM banh\");
ResultSetMetaData RSMD = res.getMetaData();
NumberOfColu
That is a poor example to use:
Instead check out the Table From Database Example
code found in Table From Database. This example uses Vectors which will grow depending on the number of rows found in the ResultSet.
I don't know how to add row to JTable and Database
You can use the addRow(...)
method of the DefaultTableModel
to add data dynamically. Read the API or search the forum/web for examples that use the addRow(...) method.
For database inserts you can start with the tutorial on JDBC Database Access.