File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes OK here's a daft SQL problem for you... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "OK here Watch "OK here New topic

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

Bob Backlund
Ranch Hand

Joined: Jun 05, 2003
Posts: 51
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

Joined: Jan 10, 2002
Posts: 63873

Are you using parameterized PreparedStatements? If not, you should. It will handle all the delimiter nonsense for you.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: OK here's a daft SQL problem for you...
jQuery in Action, 3rd edition