Context. H ii regions in galaxies are the sites of star formation, so they are special places for understanding the build-up of stellar mass in the universe. The line ratios of this ionized gas are frequently used to characterize the ionization conditions. In particular, the oxygen abundances are assumed to trace the chemical enrichment of galaxies. Aims. We explore the connections between the ionization conditions and the properties of the overall underlying stellar population (ionizing or not-ionizing) in H ii regions, in order to uncover the actual physical connection between them. Methods. We use the H ii regions catalog from the CALIFA survey, which is the largest in existence with more than 5000 H ii regions, to explore their distribution across the classical [O iii] λ5007/Hβ vs. [N ii] λ6583/Hα diagnostic diagram, and the way it depends on the oxygen abundance, ionization parameter, electron density, and dust attenuation. The location of H ii regions within this diagram is compared with predictions from photoionization models. Finally, we explore the dependence of the location within the diagnostic diagram on the properties of the host galaxies, the galactocentric distances, and the properties of the underlying stellar population.Results. The H ii regions with weaker ionization strengths and more metal-rich are located in the bottom righthand area of the diagram. In contrast, those regions with stronger ionization strengths and more metal poor are located in the upper lefthand end of the diagram. Photoionization models per se do not predict these correlations between the parameters and the line ratios. The H ii regions located in earlier-type galaxies, closer to the center and formed in older and more metal-rich regions of the galaxies are located in the bottom-right area of the diagram. On the other hand, those regions located in late-type galaxies in the outer regions of the disks and formed on younger and more metal-poor regions lie in the top lefthand area of the diagram. The two explored line ratios show strong correlations with the age and metallicity of the underlying stellar population.Conclusions. These results indicate that although H ii regions are short-lived events, they are affected by the total underlying stellar population. One may say that H ii regions keep a memory of the stellar evolution and chemical enrichment that have left an imprint on both the ionizing stellar population and the ionized gas. Key words. galaxies: abundances -galaxies: star formation -galaxies: evolution -galaxies: ISM Appendix A is available in electronic form at http://www.aanda.orgArticle published by EDP Sciences A47, page 1 of 17 A&A 574, A47 (2015)