title: "java.sql.SQLException: SAVEPOINT _667166fe_13ab4b3e3de__8000 does not exist" exception occur in nested transaction rollback ?
body: <p>class User {</p>
  
  <pre><code>public static void main(String arg[]) throws SQLException {
      Connection con = DBConnect.getConnection();
      con.setAutoCommit(false);
      PreparedStatement pstmt;
      System.out.println(con.getMetaData().supportsSavepoints()); // true
      try {
          pstmt = con.prepareStatement("insert into emp(emp_id, emp_name, salary, address, contact_number)values(?,?,?,?,?)");
          pstmt.setInt(1, 1);
          pstmt.setString(2, "a");
          pstmt.setDouble(3, 8);
          pstmt.setString(4, "s");
          pstmt.setInt(5, 9);
          pstmt.executeUpdate();
          con.commit();
          Savepoint sp = con.setSavepoint();
          if (myMethod(con)) {
              /**
               * I want to rollback the nested transaction if any error occur
               */
              con.rollback(sp);
          }
      } catch (SQLException e) {
          e.printStackTrace();
      }
  }
  
  public static boolean myMethod(Connection con) throws SQLException {
  
      PreparedStatement pstmt;
      try {
          pstmt = con.prepareStatement("insert into emp(emp_id, emp_name, salary, address, contact_number)values(?,?,?,?,?)");
          pstmt.setInt(1, 2);
          pstmt.setString(2, "G");
          pstmt.setDouble(3, 8);
          pstmt.setString(4, "G");
          pstmt.setInt(5, 10);
          pstmt.executeUpdate();
          con.commit();
      } catch (SQLException e) {
          e.printStackTrace();
      }
      return true;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>In the above code I want to rollback the nested transaction if any condition would fail . I have created a savepoint just after committing first transaction.I am getting an exception </p>
  
  <pre><code>java.sql.SQLException: SAVEPOINT _667166fe_13ab4b3e3de__8000 does not exist
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2928)
  at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
  at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
  at com.mysql.jdbc.Connection.execSQL(Connection.java:2988)
  at com.mysql.jdbc.Statement.executeUpdate(Statement.java:935)
  at com.mysql.jdbc.Statement.executeUpdate(Statement.java:873)
  at com.mysql.jdbc.Connection.rollback(Connection.java:4777)
  at com.User.main(User.java:31)
  </code></pre>
  
  <p>I would like to know whether the nested transaction will rollback or not ? </p>