Suppose $A$ and $B$ are two commutative rings, and let $f:A\rightarrow B$ be a ring homomorphism. Suppose that the induced map on the spectra $f^*:Spec B\rightarrow Spec A$ is an open immersion. What does it say about $f$? does it follows that $f$ is a localization?
edit: Thanks for the answer! What about closed immersions? is this case simpler? Is it true that a closed immersion is always of the form $A\rightarrow A/I$ for some ideal $I$ in $A$?