AboutArtemus Harper Expertise I have a BS in computer science and am working towards a Masters degree.
Experience I have experience in Core Java, good background in Java swing/gui, some experience with JNI, Java reflection, and Java java.nio.*
knowledge of Java bytecode and annotations.
Basics in c++ and c#
Question i want to edit the cells in JTable which takes its data from a MS-Access database and those edits should get saved in the database.i defined the setValueAt ,getValueAt IN TABLEMODEL and have made a class implementing TableModelListener and called that in the main class (main class containing the jtable).i am able to change the values in cell but the values are not being saved on clicking of a button "update" .
PLEASE HELP ME AS SOON AS POSSIBLE.
Answer In your Connection object (assuming you are using the java.sql package) you would first turn off auto commit in the Connection interface, e.g. con.setAutoCommit(false). Then you any changes made should be done though the updateXXX method in ResultSet. When you want to save the changes you can call commit() in the Connection interface, or if you want to revert you can call rollback().
There is no reason to have a table listener if you are already implementing the setValueAt method.