It's almost ( :roll: ) always better to be clear about your context and what your problem is -- what you are trying to do -- than to just ask a specific question about subproblem. It appears that you've had trouble in the past inserting text with embedded single quotes into your database, and as a result of that, you are doing your own custom encoding of that character as a star of some sort (although it looks like an o with a diaeresis to me!). I would suggest the solution is to use a Prepared Statement instead of just a Statement and your ad hoc approach. If you do this, your need for a StringBuffer disappears.
Code using a prepared statement is also simpler to write, something like: [ November 28, 2005: Message edited by: Jeff Albrechtsen ]