Support nested transactions with MYSQL.
If you are in a nested transaction you already have a connection open. Trying to open another connection will block and error with: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction.
Instead test if there is a connection already open and don't open another if there is one present.