We use the decomposition of the discrete spectrum of the Weil representation of the dual reductive pair ( S L ~ 2 , O ( Q ) ) ({\tilde {SL}_2},\;O(Q)) to construct a generalized Shimura correspondence between automorphic forms on O ( Q ) O(Q) and S L 2 ~ \widetilde {S{L_2}} . We prove a generalized Zagier identity which gives the relation between Fourier coefficients of modular forms on S L 2 ~ \widetilde {S{L_2}} and O ( Q ) O(Q) . We give an explicit form of the lifting between S L 2 ~ \widetilde {S{L_2}} and O ( n , 2 ) O(n,2) in terms of Dirichlet series associated to modular forms. For the special case n = 3 n = 3 , we construct certain Euler products associated to the lifting between S L 2 S{L_2} and S p 2 ≅ O ( 3 , 2 ) {\text {S}}{{\text {p}}_2} \cong O(3,2) (locally).