5 messages in com.mysql.lists.javaRe: problems with inserting large tex...
FromSent OnAttachments
Steve Stallion05 Jul 2002 09:25 
Mark Matthews05 Jul 2002 19:37 
Scott Hodson05 Jul 2002 20:30 
Mark Matthews06 Jul 2002 06:35 
Andrew Houghton06 Jul 2002 10:51 
Subject:Re: problems with inserting large text fields
From:Mark Matthews (mmat@thematthews.org)
Date:07/05/2002 07:37:04 PM
List:com.mysql.lists.java

----- Original Message ----- From: "Steve Stallion" <ssta@travelnow.com> To: <ja@lists.mysql.com> Sent: Friday, July 05, 2002 11:25 AM Subject: problems with inserting large text fields

hello all,

i am inserting into a table around 42k of text data - it bombs around 1/8

of the way in giving a sql syntax error. in the code, i properly escape all 's and "s... if i enter in the text by hand in the client, it works fine. ive used a variety of drivers, (mm.mysql and caucho's mysql driver) so i know its not a driver issue. the following exception is thrown:

Exception in thread "main" java.sql.SQLException: Syntax error or access

violation: You have an error in your SQL syntax near 'right, beyond the Trinity Tower is the <a href=\"/detail.html?detailID=280690\">' at line 1

at org.gjt.mm.mysql.MysqlIO.sendCommand(Unknown Source) at org.gjt.mm.mysql.MysqlIO.sqlQueryDirect(Unknown Source) at org.gjt.mm.mysql.MysqlIO.sqlQuery(Unknown Source) at org.gjt.mm.mysql.Connection.execSQL(Unknown Source) at org.gjt.mm.mysql.Connection.execSQL(Unknown Source) at org.gjt.mm.mysql.Statement.executeUpdate(Unknown Source) at org.gjt.mm.mysql.jdbc2.Statement.executeUpdate(Unknown Source) at XMLCram.processCityFile(Unknown Source) at XMLCram.main(Unknown Source)

It appears you're using PreparedStatements, which means you _shouldn't_ escape any of the characters. The driver(s) are doing that for you. So, your characters are getting double escaped :(

-Mark