We present an exact solution of a confined model of the non-relativistic quantum harmonic oscillator, where the effective mass and the angular frequency are dependent on the position. The free Hamiltonian of the proposed model has the form of the BenDaniel-Duke kinetic energy operator. The position-dependency of the mass and the angular frequency is such that the homogeneous nature of the harmonic oscillator force constant k and hence the regular harmonic oscillator potential is preserved. As a consequence thereof, a quantization of the confinement parameter is observed. It is shown that the discrete energy spectrum of the confined harmonic oscillator with position-dependent mass and angular frequency is finite, has a non-equidistant form and depends on the confinement parameter. The wave functions of the stationary states of the confined oscillator with position-dependent mass and angular frequency are expressed in terms of the associated Legendre or Gegenbauer polynomials. In the limit where the confinement parameter tends to ∞, both the energy spectrum and the wave functions converge to the well-known equidistant energy spectrum and the wave functions of the stationary non-relativistic harmonic oscillator expressed in terms of Hermite polynomials. The position-dependent effective mass and angular frequency also become constant under this limit.