If the localization of a ring $R$ at every prime ideal is an integral domain, must $R$ be an integral domain? 
Let $R$ be a commutative ring. Suppose that for every prime ideal $\mathfrak p$ of $R$, the localization $R_{\mathfrak p}$ is an integral domain. Must $R$ be a integral domain?

I was trying to think of counter-examples, but kept getting $R_{(0)}$ = the zero ring, which is not a domain.
Any guidance would be much appreciated. Thanks.
 A: Those examples here are with disconnected spectrum.

So we might hope that if $R$ has no non-trivial idempotent elements and $R_{\mathfrak{p}}$ is a domain for every prime ideal $\mathfrak{p}$, does this conditions imply that $R$ is a domain?

We know that adding one more condition that assumes $R$ is Noetherian or has only finitely many minimal prime ideals the implication holds.
Suppose $\mathfrak{p}_i,i=1,2,\ldots,n$ be all the minimal prime ideals of $R$. Then the condition $R_{\mathfrak{p}}$ is integral for every prime ideal $\mathfrak{p}$ is exactly saying that $R$ is reduced and $R=\mathfrak{p}_i+\mathfrak{p}_j$ when $i\neq j$. So by Chinese remainder theorem, $R=R/\mathfrak{p}_1\times\cdots\times R/\mathfrak{p}_n$. And if we assume $R$ has no non-trivial idempotent elements, then $R$ has only one minimal prime ideal which is zero, namely, $R$ is a domain.
However, I do not know if whether it is still true without the assumption that $R$ has finitely many minimal prime ideals.
I am not clear whether the continuous functions ring on $[0,1]$, i.e., $A=C[0,1]$, is a counter-example.
It is clear that $A$ is not a domain, $A$ is reduced and $A$ is connected! So the only one problem is that whether for any two minimal primes $\mathfrak{p}$ and $\mathfrak{q}$ are comaximal. (I remember this is true, but I do not remember from where I know this result.)
A: Zev's and Georges' answers are complete. I would like to give you a deeper sight. This is a guide line through easy claims that you should be able to prove on your own. Let $A$, $B$ be two rings.


*

*Every ideal of $A \times B$ is of the form $I \times J$, for unique ideals $I \subseteq A$ and $J \subseteq B$. If this is the case, $(A \times B) / (I \times J) \simeq (A / I) \times (B / J)$.

*$A \times B$ is a domain iff ($A$ is a domain and $B = 0$) or ($B$ is a domain and $A = 0$).

*Every prime ideal of $A \times B$ is of the form $\mathfrak{p} \times B$, for some prime ideal $\mathfrak{p}$ of $A$, or $A \times \mathfrak{q}$, for some prime ideal $\mathfrak{q}$ of $B$.

*The localization $(A \times B)_{\mathfrak{p} \times B}$ is isomorphic to $A_\mathfrak{p}$, for every prime ideal $\mathfrak{p}$ of $A$.
This proves that if a ring $R$ is the product of a finite number ($\geq 2$) of integral domains, then $R$ is not a domain but every its localization at primes is a domain.
This has also a geometric interpretation, if you know Zariski topology on the prime spectrum of a ring. From (3) you have a homeomorphism $\mathrm{Spec} (A \times B) \simeq \mathrm{Spec} A \coprod \mathrm{Spec} B$, then $\mathrm{Spec} (A \times B)$ is disconnected and is locally the spectrum of a domain, if $A$ and $B$ are domains.
A: One simple counterexample is $R=\mathbb{Z}/6\mathbb{Z}$. The prime ideals of $R$ are $P=2\mathbb{Z}/6\mathbb{Z}$ and $Q=3\mathbb{Z}/6\mathbb{Z}$ and $R_P$ is an integral domain (the argument easily carries over for $R_Q$), while $R$ clearly is not.
A: A broad class of answers that encompasses some of the specific examples already mentioned:
It is known that a commutative ring is von Neumann regular iff its localizations at prime ideals are all fields.
But a von Neumann regular ring is only a domain if it is a field. Von Neumann regular rings are a huge class with lots of examples which aren't bound by chain conditions. The main reason they make good candidates is because their prime ideals are maximal (so the result of the localization is rigged.)
A: No: $R=\mathbb Q\times \mathbb Q$ .
A: While as the other answers have pointed out that such a ring $R$ need not be an integral domain in general, if $R$ has only one minimal prime ideal then the claim holds. To see this, let $I$ be the minimal prime. Since $R_P$ is an integral domain for every prime ideal $P$ and $I_P$ is a minimal prime in $R_P$, we must have that $I_P=(0)_P$ for all prime ideals $P$. Thus by the local-global principle, $I=(0)$ so $R$ is an integral domain.
