Just before David dies (1015 BC), he appoints his son Solomon (1034-975, 59 years) ruler in his place. Priest Zadok and prophet Nathan affirm David’s choice by anointing Solomon king. David soon dies and, after a brief dynastic struggle, Solomon rules as king (1 Kings 1-2).
One night Solomon has a dream. In it Yahweh asks him what he desires. Given his youth, Solomon requests wisdom enough to rightly govern the people of Yahweh. This response so delights Yahweh that he grants wisdom to Solomon plus the riches and honors he did not seek (ch. 3).