It may seem, however, to follow from this, that Paul had not by any means prayed in faith, if we would not make void all the promises of God. ‘We read everywhere in Scripture, that we shall obtain whatever we ask in faith: Paul prays, and does not obtain.’ I answer, that as there are different ways of asking, so there are different ways of obtaining. We ask in simple terms those things as to which we have an express promise — as, for example, the perfecting of God’s kingdom, and the hallowing of his name, (Matthew 6:9), the remission of our sins, and every thing that is advantageous to us; but, when we think that the kingdom of God can, nay must be advanced, in this particular manner, or in that, and that this thing, or that, is necessary for the hallowing of his name, we are often mistaken in our opinion. In like manner, we often fall into a serious mistake as to what tends to promote our own welfare. Hence we ask those former things confidently, and without any reservation, while it does not belong to us to prescribe the means. If, however, we specify the means, there is always a condition implied, though not expressed. Now Paul was not so ignorant as not to know this. Hence, as to the object of his prayer, there can be no doubt that he was heard, although he met with a refusal as to the express form. By this we are admonished not to give way to despondency, as if our prayers had been lost labor, when God does not gratify or comply with our wishes, but that we must be satisfied with his grace, that is, in respect of our not being forsaken by him. For the reason, why he sometimes mercifully refuses to his own people, what, in his wrath, he grants to the wicked, is this — that he foresees better what is expedient for us, than our understanding is able to apprehend.
John Calvin, Commentary on Corinthians, Vol. 2, 2 Cor. 12:8