Picard group of reducible varieties What's the strategy for computing the Picard group of a variety with more than one irreducible components? 
For instance, consider the simple case where $X$ has two components $C$ and $D$, meeting transversely at one point. Then it seems that $\text{Pic}(X)=\text{Pic}(C)\times\text{Pic}(D),$ but I don't know how to prove it.
Thanks.
Edit: I'd like to see a formal proof (or a reference), i.e. using cohomology etc., instead of using "gluing", especially when we are not gluing along open intersections. The map $C\coprod D\to X$ is not flat, so there's no fppf gluing either.
 A: It is certainly not always true that it is the product. Consider this: you have two restriction maps ${\rm Pic}(C)\to {\rm Pic} (C\cap D)$ and ${\rm Pic}(D)\to {\rm Pic} (C\cap D)$. In order for the two line bundles you pick on $C$ and $D$ to glue together, they would have to agree on ${\rm Pic} (C\cap D)$. In fact, that way one gets a surjective map:
$$
{\rm Pic(X)}\to {\rm Pic}(C)\times_{{\rm Pic} (C\cap D)} {\rm Pic}(D).
$$
There are obvious restriction maps ${\rm Pic}(X)\to {\rm Pic} (C)$ and ${\rm Pic}(X)\to {\rm Pic} (D)$  and since a line bundle on $X$ is exactly one on each of $C$ and $D$ that agree on the intersection, it follows that ${\rm Pic}(X)$ maps onto the categorical fibered product of ${\rm Pic}(C)$ and ${{\rm Pic} (D)}$ over ${\rm Pic}(C\cap D)$.
EDIT Changed isomorphism to surjective map following Qing Liu's observation.
This map is injective if for example the intersection is geometrically connected and geometrically reduced.
A: If the intersection is nice enough, then a line bundle on $X$ consists of an isomporhism class of patching data $(P_C,P_D,\alpha)$ where $\alpha$ is an isomorphism from $P_C|_D$ to $P_D|_C$.
But this does require some assumptions.  In the affine case, if $X=Spec(R)$, then you need $R$ to be the pullback of $\Gamma(C)$ and $\Gamma(D)$ over $\Gamma(C\cap D)$.
(I don't actually have an immediate counterexample without this assumption, but certainly the usual proofs require it, and certainly the obvious functor from patching data to line bundles doesn't work without it.)
A: I will only consider the case of connected projective (this is not really necessary) curves $X, C, D$. over an algebraically closed field $k$. The canonical injection $O_X\to O_C\times O_D$ induces an exact sequence of sheaves on $X$ 
$$ 1 \to O_X^* \to O_C^* \times O_D^* \to F \to 1 $$
where $F$ is a skyscrapper sheaf supported at the intersection points of $C$ and $D$. Passing to cohomology,
we get 
$$ 1 \to k^* \to k^* \times k^* \to F(X) \to \mathrm{Pic}(X)\to \mathrm{Pic}(C) \times \mathrm{Pic}(D)\to H^1(X, F)=0.$$ 
When $C, D$ intersect transversally at a single point (ordinary double point), a local computation shows that $k^* \times k^*\to F(X)$ is surjective, and you get your isomorphism. 
As Steven said, this really depends on how $C$ and $D$ intersect (in fact, when $C$ and $D$ are smooth, your isomorphism implies that $C$ and $D$ intersect transversally at a single point; non transversal intersection point can give additive subgroup in $\mathrm{Pic}(X)$ and more transversally intersection points give subtori in $\mathrm{Pic}(X)$). Also in higher dimension $H^1(X, F)$ may not vanish, and the above methode does not work. 
The general picture for proper curves can be found in Bosch, Lütkebohmert and Raynaud, Néron Models, Chap. 9., §2. They make a ''dévissage'' of $\mathrm{Pic}^0(X)$. 
[EDIT] Let me rewrite Sándor's nice interpretation in cohomological terms. It will make explicit the sheaf $F$ above and gives a better understanding of what is going on, and in any dimension. Denote by $E=C\cap D$ the closed subscheme defined by the ideal $J_C+J_D$. Then we have an exact sequence of sheave on $X$: 
$$ 1 \to O_X^* \to O_C^* \times O_D^* \to O^*_{E} \to 1 $$ 
in the middle, the map is $(a, b)\mapsto a|_E (b|_E)^{-1}$. The exactness is checked locally. Passing to cohomology, we get
$$ O(C)^\star\times O(D)^\star\to O(E)^* \to \mathrm{Pic}(X) \to \mathrm{Pic}(C)\times \mathrm{Pic}(D)\to \mathrm{Pic}(E)$$
and the last map is $(L, H)\mapsto L_{|E}\otimes (H_{|E})^{-1}$, therefore the exact sequence becomes
$$ O(C)^\star\times O(D)^\star\to O(E)^\star \to \mathrm{Pic}(X) \to \mathrm{Pic}(C)\times_{\mathrm{Pic}(E)} \mathrm{Pic}(D)\to 1.$$
So Sándor's map $\mathrm{Pic}(X) \to \mathrm{Pic}(C)\times_{\mathrm{Pic}(E)} \mathrm{Pic}(D)$ is always surjective. It is injective if and only if $O(C)^\star\times O(D)^\star\to O(E)^\star$ is surjective. This is not always the case (consider two irreducible curves  meeting at more than one point or meeting at a single point but not transversally which implies that $E$ is a non-reduced point), but is true if for instance $O(E)=k$ (e.g. $E$ is geometrically connected, geometrically reduced and proper).  
[EDIT 2] Of course, in all this answer, $X$ is supposed to be reduced. Otherwise $O_X\to O_C\times O_D$ (and that one with invertible functions) would not be necessarily injective. If $X$ is not reduced, there is a dévissage from $\mathrm{Pic}(X)$ to $\mathrm{Pic}(X_{\mathrm{red}})$ in Bosch & al, op. cit. 
A: I try a down to earth sketch of proof. 
Suppose, w.l.o.g., that $C$ and $D$ are connected. Let
$\pi:W=C\sqcup D \rightarrow X=C \;\;\cup_x\; D$
the map that glues the two components at $x\in X$ (This should be, btw, a coproduct in the category of schemes of $C$ and $D$ along the inclusion of the closed point $x$). Let
$\pi^{\star}:\mathrm{Pic}(X)\rightarrow \mathrm{Pic}(W)=\mathrm{Pic}(C)\times \mathrm{Pic}(D)$
be the induced map.
Now, line bundles $L$ have total spaces $tot(L)$, and two line bundles over a variety are isomorphic iff the corresponding total spaces are isomorphic as "geometric vector bundles". 
Remark: if $\widetilde{L}$ is a line bundle on $W$, then $tot(\widetilde{L})$ is the disjoint union of $tot(L')$ and $tot(L'')$ for (uniquely determined) l.b.'s $L'$ and $L''$ on $C$, $D$ respectively.
Remark: given line bundles $\widetilde{L}$ on $W$ and $L$ on $X$, we have $\widetilde{L}=\pi^{\star}(L)$
iff $tot(L)$ is the union (=coproduct), along the fiber over $x$, of the total spaces $tot(L')$ and $tot(L'')$ defined above.
Since 
$(C\times\mathbb{A}^1)\sqcup_{x\times\mathbb{A}^1}(D\times\mathbb{A}^1)\cong (C\sqcup_x D)\times\mathbb{A}^1$
then the trivial bundle on $W$ can only come, via $\pi^{\star}$, from the trivial bundle on $X$, i.e. $Ker(\pi^{\star})=0$.
We can see $\pi^{\star}$ is also surjective, because given a bundle $\widetilde{L}$ on $W$, we can glue the corresponding $L'$ and $L''$ along their fibers over $x$, so obtaining a bundle $L$ on $X$ that verifies $\widetilde{L}=\pi^{\star}(L)$.
