Exact sequence of sheaves with non exact sequence of global sections

Solution 1:

If $p$ is a point on a compact Riemann surface of genus one, we have the exact sequence of sheaves $0 \to \mathcal O \to \mathcal O(p)\to \mathbb C_p \to 0$ (the last non zero sheaf being a sky-scraper sheaf) .
The sequence of global sections is $$ 0 \to \mathbb C = \mathbb C \stackrel {0} {\to}\mathbb C \to 0 $$ and is thus not exact.

Solution 2:

Let $M$ be a smooth manifold and consider the de Rham sheaf sequence on $M$:

$$0\to\mathbf{R} \to \mathcal{O}_M \to \Omega^1_M\to \Omega^2_M\to \dots$$

where the first map is inclusion and the other maps are exterior differentiation. It is exact as a sequence of sheaves by the Poincaré lemma, but on global sections it is the usual de Rham complex, whose cohomology is the de Rham cohomology. Of course unless $M$ is 1-dimensional, is not a short exact sequence, but nevertheless, the phenomenon is the same.

Solution 3:

Let $X=\mathbb{A}^1_k$ where $k$ is an infinite field. Take $Y=\{p,q\}$ where $p,q$ are two distinct closed points of $X$ and let $U=X-Y.$ Take $\mathbb{Z}_Y=j_{\star}(\mathbb{Z}|_Y)$ where $j: Y \hookrightarrow X$ is the inclusion and $\mathbb{Z}_U=i_{!}(\mathbb{Z}|U)$ for the inclusion $i:U \hookrightarrow Z.$

Show that the following is an exact sequence

$$0 \longrightarrow \mathbb{Z}_U\longrightarrow \mathbb{Z}\longrightarrow \mathbb{Z}_Y\longrightarrow 0$$

and $H^1(X,\mathbb{Z}_U) \neq 0.$

I'm sure you can find tones of more non-trivial examples in literature.