The defect states in optical microcavities are demonstrated to be related to the different confinement states by analyzing the photonic band structure of the equivalent photonic quantumwell structure consisted of a photonic well confined by photonic barriers. Our results indicate that the defect states in optical microcavities could be divided namely into the localized, pseudo-localized, and non-localized modes, and explain the relationship between the localized states in optical microcavities and confinement effects of the electric field in the defect layers.