The quotation here is from the history of Samuel and from a Psalm of Ethan in the Old Testament.
"to be their king for forty years"