title: How to make this jtable value saved in database when it is edited?
body: <p>This code will display all record from my table.
  When record is displayed i want to be editable.
  When any record is edited it should be saved in database.
  Please guys any help will do.</p>
  
  <pre><code>import java.sql.*;
  import javax.swing.*;
  import java.awt.event.*;
  import java.awt.*;
  
  class user_list2 extends JFrame
  {
      Container con;
  
      int rows=0;
      Object data1[][];   
      JScrollPane scroller;
      JTable table;
  
  
      user_list2()
      {
          con=getContentPane();
          con.setLayout(new BorderLayout());
          setSize(800,600);
          setLayout(new BorderLayout());
  
          Connection conn;
          Statement st;
          ResultSet rs;
  
          try
          {
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          }
          catch(ClassNotFoundException ce)
          {System.out.println("error");}
  
          try
          {
              conn=DriverManager.getConnection("jdbc:odbc:abc");  
              st=conn.createStatement();  
              rs=st.executeQuery("select * from Patients Where Status='Discharged' ");
  
              while(rs.next())
              {
  
                  rows++;
              }
  
  
  
                  data1=new Object[rows][10];     Object[] Colheads={"Patients Name","Age", "Sex","Admit Date","Description","Reference","No Of Dependent","Status","Type Of Room","ID"};
                  rs=st.executeQuery("Select * from Patients Where Status='Discharged' ");
                  for(int i1=0;i1&lt;rows;i1++)
                  {
                      rs.next();
                      for(int j1=0;j1&lt;10;j1++)
                      {
                          data1[i1][j1]=rs.getString(j1+1);
                      }
                  }
                  JTable table=new JTable(data1,Colheads);
  
  
                  int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
                  int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
                  JScrollPane jsp=new JScrollPane(table,v,h);
  
  
                  con.add(jsp);
  
  
              }
          catch(SQLException ss)
          {
  
          System.out.println("error"+ss);
          ss.printStackTrace();
          }
      }
  
      public static void main(String[] ar)
      {
  
          user_list2 obj=new user_list2();
          obj.setSize(900,600);       
          obj.show();
  
      }
  }
  </code></pre>