I think we need some more information before we can help you. What is the "binary data" in the DB? Excel files are generally created using text, numbers and formulas - which would be text, not binary. You would use a library like Apache POI to create the actual file.
Since you posted this in the
Struts forum, are you intending to stream the file to a web browser?
(By the way, nobody here will write the code for you, but we'll help you to write it.)