ensuring connection exists before entering a transaction