Updated query execution logic to execute all the statements on the same connection.