the king’s - Jehovah, peculiarly the king of Israel in the theocracy; Ecc 8:3, Ecc 8:4, prove it is not the earthly king who is meant.
the oath of God - the covenant which God made with Abraham and renewed with David; Solomon remembered Psa 89:35, “I have sworn,” etc. (Psa 89:36), and the penalties if David’s children should forsake it (Psa 89:30-32); inflicted on Solomon himself; yet God not “utterly” forsaking him (Psa 89:33, Psa 89:34).