Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OK here's a daft SQL problem for you...

 
Bob Backlund
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK second post of the day. Got my DB working and got my JSPs displaying and removing and inserting data, etc... But!

Noticed a problem in the code. If in and of the text firlds I put a ' or " symbol, it kills the SQL. I know this is because the query string is just that, a string (in Java/JSP); and the quote is obviously cutting off the end of the string. But does anyone know away round this? Aparft from the obvious, don't have ' or " in the string! :-)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using parameterized PreparedStatements? If not, you should. It will handle all the delimiter nonsense for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic