| Bug #4279 | SQL exception when the data is \'{{} | ||
|---|---|---|---|
| Submitted: | 24 Jun 2004 21:08 | Modified: | 28 Mar 2014 14:06 |
| Reporter: | yusang kwan | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | Connector / J | Severity: | S2 (Serious) |
| Version: | OS: | Linux (Linux) | |
| Assigned to: | Alexander Soklakov | CPU Architecture: | Any |
[24 Jun 2004 22:41]
Mark Matthews
Two things you should be aware of. First, the escape processing in Connector/J 3.0.11 and newer is better, so that might fix it.
In any case, '{' is a _reserved_ character in JDBC unless is is _inside_ a '' sequence, so you need to escape it with '\', or alternatively turn off escape processing altogether by calling .setEscapeProcessing(false) on the statement in question.
[28 Mar 2014 14:06]
Alexander Soklakov
I close this report as "Can't repeat" because there is no feedback for a long time and codebase is too old. Please, feel free to reopen it if the problem still exists in current driver.

Description: Java SQL statement =>insert into logs (Logtimestamp, shortText) values (NOW(), QUOTE("<NewChat><ChatMessage SenderID='nusrat' RecipientID='test9'><Sender>nusrat</Sender><Recipient>test test</Recipient><MsgID>994f3fe2b6049aab83e0ab9ed3c09960</MsgID><ConversationID>f8a830839a07684ee031b6ba647b5fb8</ConversationID><Timestamp>2004-06-24T14:49:30.0000570</Timestamp><Priority>NORMAL</Priority><Text>\'{{}</Text><Ack></Ack><AckBy></AckBy></ChatMessage></NewChat>") ) *2:49:30:574 PM 6-24-04* IMTDebug[0]** EXCEPTION! Not a valid escape sequence: {{}', '', '') java.sql.SQLException: Not a valid escape sequence: {{}', '', '') at com.mysql.jdbc.EscapeProcessor.escapeSQL(EscapeProcessor.java:75) at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1226) at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1200) at com.eci.imtrader.server.utility.Log.log(Log.java:73) at com.eci.imtrader.server.components.packetprocessors.chat.SendChatMessagePacketProcessor.process(SendChatMessagePacketProcessor.java:130) at com.eci.imtrader.server.components.packetprocessors.PacketProcessor.run(PacketProcessor.java:94) at java.lang.Thread.run(Thread.java:536) How to repeat: insert the string \'{{} to a text field using jdbc (mysql-connector-java-3.0.10-stable-bin.jar).