Code example for PreparedStatement

Methods: executeUpdate, setInt, setLong

0
    try 
    { 
      stmt =
          conn.prepareStatement("update bootstrap_loginfo set minwindowscn = ? , maxwindowscn = ? , maxrid = ? where srcid = ? and logid = ?");
 
      stmt.setLong(1, _minwindowscn);
      stmt.setLong(2, _maxwindowscn);
      stmt.setInt(3, _maxRowId);
      stmt.setInt(4, _srcid);
      stmt.setInt(5, _currlogid);
 
      stmt.executeUpdate();
      conn.commit();
    } 
    catch (SQLException e)
    { 
      LOG.error("Error occurred when saving source info to database" + e);
      throw e;
    } finally { 
    	DBHelper.close(stmt);
    } 
  } 
 
  public void switchLogFile(Connection conn) throws SQLException
  {