We present molecular-line observations at millimetre, centimetre and infrared wavelengths of the region containing OH(1720 MHz) masers in the supernova remnant (SNR) G349.7+0.2, using the Australia Telescope (AT) Mopra antenna, the Swedish–ESO Submillimeter Telescope, the AT Compact Array and the UNSW Infrared Fabry–Perot narrow-band filter installed on the Anglo-Australian Telescope. Several molecular transitions were observed between 1.6 and 3 mm to constrain the physical parameters of the molecular cloud interacting with the SNR and to investigate the effects of the SNR shock on the gas chemistry. We detected shock-excited near-infrared H₂ emission towards the centre of the SNR, revealing highly clumped molecular gas and a good correlation with published mid-infrared images from the Spitzer Space Telescope. An excellent correlation between the H2 clumps and OH(1720 MHz) maser positions supports the shock excitation of the OH(1720 MHz) maser emission. Furthermore, we detected OH absorption at 1665 and 1667 MHz which shows a good correlation with the shocked H₂ emission and the masers. We found maser emission at 1665 MHz near the OH(1720 MHz) masers in this SNR, which is found to be associated with a GLIMPSE source SSTGLMC G349.7294+00.1747. We also detected 1665 and 1667 MHz OH masers, and weak 4.8 GHz H₂CO absorption towards the ultracompact H ii region IRAS 17147–3725 located to the southeast of the SNR. We found no 4.7- or 6-GHz excited-state OH masers or 6-GHz CH₃OH maser towards either the SNR or the H ii region.