i want to make adding into mysql database and then when i click adds, jtable show those data automatically. but it seem to get error at display part, it shows " Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - illegal start of expression" and jtable do not show the added data but in mysql, data is properly kept.
private void jtPropertyChange(java.beans.PropertyChangeEvent evt) {
DefaultTableModel model = (DefaultTableModel) jt.getModel();
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(url, user, password);
String sql = "SELECT * FROM `companya`";
st = con.prepareStatement(sql);
rs = st.executeQuery(sql);
while(rs.next()){
String id = rs.getString("code");
String name = rs.getString("name");
String position = rs.getString("position");
String salary = rs.getString("salary");
model.addRow(new Object[]{id,name,position,salary});
}
}catch(Exception e){
System.out.println("error");}
}
the adding part seems to be fine