In this paper, we study a risk process modeled by a Brownian motion with drift (the diffusion approximation model). The insurance entity can purchase reinsurance to lower its risk and receive cash injections at discrete times to avoid ruin. Proportional reinsurance and excess-of-loss reinsurance are considered. The objective is to find the optimal reinsurance and cash injection strategy that minimizes the total cost to keep the company's surplus process non-negative, i.e. without ruin, where the cost function is defined as the total discounted value of the injections. The optimal solution is found explicitly by solving the according quasi-variational inequalities (QVIs).