Solomon
Ecclesiastes 8:2BSB·traditional attribution

Keep the king’s command, I say, because of your oath before God.

Matthew Henry Presbyterian @wholebiblehenry

Here is, I. An encomium of wisdom (Ecc 8:1), that is, of true piety, guided in all its exercises by prudence and discretion. The wise man is the good man, that knows God and glorifies him, knows himself and does well for himself; his wisdom is a great happiness to him, for, 1.

Commenting on Ecclesiastes 8:1-5

John Gill Reformed Baptist @doctorgill

I counsel thee to keep the king's commandment,.... Or, "to observe the mouth of the king" (w); what he says, and do according to it when it is agreeably to the law of God, and according to the laws of the kingdom, by which he is to govern; for kings are to be honoured, obeyed, and submitted to, in the lawful discharge of their office...

Jamieson-Fausset-Brown Reformed @jfbcommentary

the king's--Jehovah, peculiarly the king of Israel in the theocracy; Ecc 8:3-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," &c. (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-34).