A new construction of rings is introduced, studied, and applied. Given surjective homomorphisms $Rto Tgets S$ of local rings, and ideals in $R$ and $S$ that are isomorphic to some $T$-module $V$, the emph{connected sum} $R#_TS$ is defined to be the local ring obtained by factoring out the diagonal image of $V$ in the fiber product $Rtimes_TS$. When $T$ is Cohen-Macaulay of dimension $d$ and $V$ is a canonical module of $T$, it is proved that if $R$ and $S$ are Gorenstein of dimension $d$, then so is $R#_TS$. This result is used to study how closely an artinian ring can be approximated by Gorenstein rings mapping onto it. It is proved that when $T$ is a field the cohomology algebra $Ext^*_{R#_kS}(k,k)$ is an amalgam of the algebras $Ext^*_{R}(k,k)$ and $Ext^*_{S}(k,k)$ over isomorphic polynomial subalgebras generated by one element of degree 2. This is used to show that when $T$ is regular, the ring $R#_TS$ almost never is complete intersection.