5 messages in com.mysql.lists.javaRE: String with " charatchter fails i...| From | Sent On | Attachments |
|---|---|---|
| Paul Foxton | 14 Sep 2001 08:15 | |
| Ylan Segal | 14 Sep 2001 09:10 | |
| Paul Foxton | 14 Sep 2001 09:40 | |
| Ylan Segal | 14 Sep 2001 10:25 | |
| Ylan Segal | 14 Sep 2001 12:13 |
| Subject: | RE: String with " charatchter fails is truncated on INSERT![]() |
|---|---|
| From: | Paul Foxton (pa...@network-sol.com) |
| Date: | 09/14/2001 09:40:27 AM |
| List: | com.mysql.lists.java |
hmmm.
I'm also using tomcat (3.2.3) and MySQL, I've tried to replicate your error briefly with no success -
at the risk of asking another too obvious question - have you tried printing the sql insert string to the console or the web page to ensure that it isn't getting truncated before being passed to MySQL?
I know you said you've tested the string your inserting, but if the whole sql insert string looks ok then I'm pretty much stumped.....
cheers,
Paul
-----Original Message----- From: Ylan Segal [mailto:yl...@digiworks.tv] Sent: 14 September 2001 18:26 To: Paul Foxton; ja...@lists.mysql.com Subject: RE: String with " charatchter fails is truncated on INSERT
Yes, I am escaping. Example:
String test = "This is \"quoted\".";
When I try to pass that string to the database it just stores: This is
Any other ideas?
-----Original Message----- From: Paul Foxton [mailto:pa...@network-sol.com] Sent: Friday, September 14, 2001 9:16 AM To: ja...@lists.mysql.com Subject: RE: String with " charatchter fails is truncated on INSERT
hope this isn't too obvious a question, but are you using the backslash escape character before your " ?
ie INSERT INTO table_name VALUES ('null', 'blah blah \"blah\" blah');
-----Original Message----- From: Ylan Segal [mailto:yl...@digiworks.tv] Sent: 14 September 2001 17:10 To: ja...@lists.mysql.com Subject: String with " charatchter fails is truncated on INSERT
My problem is as follows:
I have developed a web-application using tomcat and mysql. The problem is that Strings that contain the character " (double-quote) are not being stored properly in mysql, what is happening is that the String is being truncated at the first appearens of the " character.
Now, if I print the String to console or web-page the Strig is NOT truncated and it is properly displayed. I am pretty sure the problem lays in the INSERT statement.
I am using mm.mysql latest drivers. My code looks like this:
..... String query = "INSERT INTO MyTable VALUES(NULL, ?)"; //The null is for an autoincrement field and second field is a VARCHAR field. PreparedStatement = con.prepareStatement(query); //con is a java.sql.Connection ps.setString(1, myString); //my String is the string with the " charachter. int count = ps.executeUpdate(); .....
Is this a problem with the driver that is not escaping the " character properly? Does anybody have a solution?
Thanks a lot for your help.
_____
---------------------------------------------------------------------
Please check
"http://www.mysql.com/Manual_chapter/manual_toc.html" before posting. To request this thread, e-mail java...@lists.mysql.com
To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail java...@lists.mysql.com instead.
---------------------------------------------------------------------
Please check
"http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail java...@lists.mysql.com
To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail java...@lists.mysql.com instead.
--------------------------------------------------------------------- Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before posting. To request this thread, e-mail java...@lists.mysql.com
To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail java...@lists.mysql.com instead.




