We study an optimal investment problem in a continuous-time framework where the interest rates follow Cox-Ingersoll-Ross dynamics. Closed form formulae for the optimal investment strategy are obtained by assuming the completeness of financial markets and the CRRA utility function. In particular, we study the behaviour of the solution when time approaches the terminal date.