Re: apostrophe problem for a preparedstatement
Posted by: Mark Matthews
Date: January 06, 2005 02:12PM

C Leung wrote:
> Hi,
>
> I have been trying to insert and update database
> records with data including apostrophe. I have
> been reading some articles and setString() in
> preparedStatement should escape all apostrophe in
> the string for me. However, it keeps giving me
> errors starting from near the first apostrophe.
>
> I have tried strings with multiple apostrophes and
> i saw from the error message that there were two
> back slashes in front of the apostrophe that
> setString() has added for me. I have tried putting
> the back slash myself, and i ended up having many
> many back slashes after setString().
>
> Can somebody please help me deal with this problem
> with apostrophes.
>
> Btw, i have tried JConnector 3.0 and 3.1 and both
> act the same.
>
> Thanks.

Can you post an example? It's kind of hard to tell what's going on without seeing the string in question, and how _you're_ quoting it before you send it to setString().

-Mark

Mark Matthews
Consulting Member Technical Staff - MySQL Enterprise Tools
Oracle
http://www.mysql.com/products/enterprise/monitor.html

Options: ReplyQuote


Subject
Written By
Posted
Re: apostrophe problem for a preparedstatement
January 06, 2005 02:12PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.