2 Samuel 6:6-7 (NKJV)
And when they came to Nachon's threshing floor, Uzzah put out his hand to the ark of God and took hold of it, for the oxen stumbled. Then the anger of the Lord was aroused against Uzzah, and God struck him there for his error; and he died there by the ark of God.
2 Samuel 6:9a
David was afraid of the Lord that day
2 Samuel 6:14a
Then David danced before the Lord with all his might
King David wanted to bring the ark of the Lord to Jerusalem, the new capital city. In the law God had given to Moses, there were specific instructions that the ark was to be carried on the Levite's shoulders but they were moving the ark on a cart pulled by oxen. David's motive was good, but the inattention to obey the details of God's holy word was dealt with severely by God.
Psalm 111:10 (NKJV)
The fear of the Lord is the beginning of wisdom; A good understanding have all those who do His commandments. His praise endures forever.
My dog loves me but when he steps out of bounds I give him a stern correction. Immediately, he will get back in line because he is motivated by a fear of and a respect for my authority in his life. So too, we should be motivated by a fear of and a reverence for the things of God.
Notice that after the correction how David worshiped before the Lord; he danced before Him with all his might. He had a glad heart and was devoted to his God.