Solomon arranged a marriage contract with Pharaoh, king of Egypt. He married Pharaoh's daughter and brought her to the City of David until he had completed building his royal palace and God's Temple and the wall around Jerusalem.
Meanwhile, the people were worshiping at local shrines because at that time no temple had yet been built to the Name of God.
Solomon loved God and continued to live in the God-honoring ways of David his father, except that he also worshiped at the local shrines, offering sacrifices and burning incense.
The king went to Gibeon, the most prestigious of the local shrines, to worship. He sacrificed a thousand Whole-Burnt-Offerings on that altar.
That night, there in Gibeon, God appeared to Solomon in a dream: God said, "What can I give you? Ask."
Solomon said, "You were extravagantly generous in love with David my father, and he lived faithfully in your presence, his relationships were just and his heart right. And you have persisted in this great and generous love by giving him - and this very day! - a son to sit on his throne.
"And now here I am: God, my God, you have made me, your servant, ruler of the kingdom in place of David my father. I'm too young for this, a mere child! I don't know the ropes, hardly know the 'ins' and 'outs' of this job.
And here I am, set down in the middle of the people you've chosen, a great people - far too many to ever count.
"Here's what I want: Give me a God-listening heart so I can lead your people well, discerning the difference between good and evil. For who on their own is capable of leading your glorious people?"
God, the Master, was delighted with Solomon's response.
And God said to him, "Because you have asked for this and haven't grasped after a long life, or riches, or the doom of your enemies, but you have asked for the ability to lead and govern well,
I'll give you what you've asked for - I'm giving you a wise and mature heart. There's never been one like you before; and there'll be no one after.
As a bonus, I'm giving you both the wealth and glory you didn't ask for - there's not a king anywhere who will come up to your mark.
And if you stay on course, keeping your eye on the life-map and the God-signs as your father David did, I'll also give you a long life."
Solomon woke up - what a dream! He returned to Jerusalem, took his place before the Chest of the Covenant of God, and worshiped by sacrificing Whole-Burnt-Offerings and Peace-Offerings. Then he laid out a banquet for everyone in his service.
The very next thing, two prostitutes showed up before the king.
The one woman said, "My master, this woman and I live in the same house. While we were living together, I had a baby.
Three days after I gave birth, this woman also had a baby. We were alone - there wasn't anyone else in the house except for the two of us.
The infant son of this woman died one night when she rolled over on him in her sleep.