thanks @seancorfield I am using HikariCP. In this case i need the connection from an open transaction and don't want to use any global var.