The issue of restrictive/non-restrictive information does come into play here, and other answers give a good account of it. Here are a couple instances, though, of how each phrase could be grammatical.
1) The book The Odyssey by Homer is set against the backdrop of the Trojan War.
You do not need commas here because the book title is essential information. Homer wrote two books that are set against the backdrop of the Trojan War, and you need to specify the Odyssey to your audience.
2) The book, The Odyssey, by Homer is set in the ten years following the Trojan War during Odysseus's journey home.
You need commas here because this information is non-essential or parenthetical information. We know which book you're describing without you naming it. Thus, furnishing the title is something extra.
The second example, to me, sounds redundant out of context, but it mimics speech patterns that you might hear in a discussion on The Odyssey. In this sense, the commas serve as pauses around the book, providing emphasis. But only incidentally. Their purpose is to separate information that is not inextricably linked.