title: how to extract data from one table and insert into another table
body: <p>i am writing a code to retrieve two columns from a table and store it in another table.i am using MS Accesses as a database.
  the code is as follows</p>
  
  <pre><code>public void connectDb(){
     try{
  
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:harish","scott","tiger");
    Statement st= con.createStatement();
    ResultSet rs=st.executeQuery("select sev,al from pgw_alarm where sev='000'");
    while(!rs.next())
    {
     String sev= rs.getString("sev");
     String al= rs.getString("al");
     st.executeUpdate("insert into info_alarm values('"+sev+"','"+al+"')");
    }
  }catch(Exception e){e.printStackTrace();
      System.out.println("some error");}
  }
  </code></pre>
  
  <p>the following stack trace </p>
  
  <pre><code>java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
      at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
  
      at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
      at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3907)
      at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:5698)
      at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:354)
      at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:411)
  </code></pre>
  
  <p>please help me in solving this problem.....</p>