The inscription shows that the psalm was composed by David; but though he was its author, there is no absurdity in his speaking of himself in the person of others. - John Calvin
v2 vs. v7: The mentioning of the name of God implies trusting only God. Not in anything else.
v5: Calvin believed "thy salvation" can be referring to both king or God. But more likely to the king's salvation, which God bestows.
v9: "king" = David's successors in so far as they were types of Christ (Calvin).