<sarcasm>The answer, of course, is to avoid the use of apostrophes.</sarcasm>
<sarcasm>Alternately, you can write a set of utility functions to parse and modify every field to cater to the whims of whatever database you're working with. This should be fun, as most DBs need to modify apostrophes, but some need to modify double quotes instead, and date formats ... well, let's say date formats and ice cream flavours work really well.</sarcasm> OR... you can use this really really nifty thing called "PreparedStatement." PreparedStatements handle escaping for you so all you do is set your data up. The escaping is handled at the driver level, so whatever needs to be preprocessed is handled by the driver written for the DB you're using, so it's, um, much less likely to be wrong. They work for dates, numbers, strings, etc. -- if the available JDBC docs elude you, you can find a simple example at http://java.enigmastation.com/Q161 . Have fun. >From: Benoit Jodoin <[EMAIL PROTECTED]> >Reply-To: A mailing list about Java Server Pages specification and >reference <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: Re: JSP Apostrophe in JDBC >Date: Wed, 4 Sep 2002 23:36:56 -0400 > >Can you give us your error msg plz?:) > >At 11:33 PM 9/4/2002 -0400, you wrote: >>I am getting an error when updating some input text records using a form >> >>When I enter an Apostrophe in the text fields and send to the jsp page >>which update the record in the db, it causes an error on the sql jdbc >>call. >> >>How do you treat Apostrophe in jsp, esp when sql is involved ? >> >> >>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff >>JSP-INTEREST". >>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST >>DIGEST". >>Some relevant FAQs on JSP/Servlets can be found at: >> >> http://archives.java.sun.com/jsp-interest.html >> http://java.sun.com/products/jsp/faq.html >> http://www.esperanto.org.nz/jsp/jspfaq.jsp >> http://www.jguru.com/faq/index.jsp >> http://www.jspinsider.com > >=========================================================================== >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff >JSP-INTEREST". >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST >DIGEST". >Some relevant FAQs on JSP/Servlets can be found at: > >http://archives.java.sun.com/jsp-interest.html >http://java.sun.com/products/jsp/faq.html >http://www.esperanto.org.nz/jsp/jspfaq.jsp >http://www.jguru.com/faq/index.jsp >http://www.jspinsider.com ----------------------------------------------- Joseph B. Ottinger [EMAIL PROTECTED] http://enigmastation.com IT Consultant _________________________________________________________________ Join the world�s largest e-mail service with MSN Hotmail. http://www.hotmail.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
