Attaching a curve by its endpoints to two spheres
This is a great case for hooks.

Position your two spheres where you want. Then add the curve between then with the two ends where you want them to touch on the spheres.

In object mode select one of the spheres then select the curve; hit Tab to go in to edit mode. In the curve's edit mode select the end point of the curve on the same end as the selected sphere, then press ctrl H. Choose hook to selected object.
Repeat for the other end of the curve on the other sphere.