What does the word "Koheles" mean and why is Shlomo called that?
The first Rashi on koheles explains that Koheles means to gather like the word קהל. He also mentions that Koheles means that he gathered (אגר) all wisdom and threw it up (vomited it). Another explanation is that he spoke in a assembly format.
"Mashiach ben David" is far from David's son. It seems to mean "descendent". Every king in Jerusalem from Shelomo to Tzidqiyahu would qualify.
To develop Rashi's second answer -- Shelomo haMelekh was the only king to do the mitzvah of haqhel. David predates the Beis haMiqdash, and after he dies, the Northern Kingdom splits off and bans its inhabitants from attending.
Further, the medrash says that Qoheles's negative tone was written when Shelomo realized that his kingdom, everything he built, was about to split apart. In other words, calling himself Qoheles may be a reference to the book's thesis.
Even religious accomplishments don't matter, just (as the book concludes) develop yir'ah for Him and do His mitzvos, and stop worrying about whether He accepts the institutions you try to build.