Praise be to Allaah.
It is not permissible to swear an oath saying I swear, O Lord, that You should send down rain, or defeat the Jews, or make So and so rich, or give him such and such, or do for me what I ask in this place, and so on. This implies that a person is obliging his Lord to do something, but it is Allaah Who controls the affairs of His slaves, and His slave has no right to make demands of his Lord or try to oblige Him to do anything. This goes against Tawheed, or it either compromises its integrity or uproots it altogether, depending on the persons intentions. The reports about some of the Salaf insisting by an oath that Allaah should do something probably refer to their duaas (supplications). The hadeeth of the Prophet (peace and blessings of Allaah be upon him): There are among the slaves of Allaah those who, if they were to insist by an oath that Allaah should do something, He would fulfil it (narrated by al-Bukhaari, 2703) is hypothetical in nature, meaning that Allaah would respond to such a person's duaa although it is known that nobody would dare to address their Lord in this manner. And Allaah knows best.