<p>I'm working with a fairly simple database, from a Java application.  We're trying to insert about 200k of text at a time, using the standard JDBC mysql adapter.  We intermittently get a <code>com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column error.</code></p>
<p>The column type is <code>longtext</code>, and database collation is <code>UTF-8</code>.  The error shows up using both <code>MyISAM</code> and <code>InnoDB</code> table engines.  Max packet size has been set ot 1 GB on both client and server sides, so that shouldn't be causing a problem, either.</p>

[{'answer_id': 73197, 'author': 'Nicholas', 'author_id': 8054, 'author_profile': 'https://Stackoverflow.com/users/8054', 'pm_score': 3, 'selected': False, 'text': '<p>Well you can make it ignore the error by doing an INSERT IGNORE which will just truncate the data and insert it anyway. (from <a href="http://dev.mysql.com/doc/refman/5.0/en/insert.html" rel="noreferrer">http://dev.mysql.com/doc/refman/5.0/en/insert.html</a> )</p>\n\n<blockquote>\n  <p>If you use the IGNORE keyword, errors\n  that occur while executing the INSERT\n  statement are treated as warnings\n  instead. For example, without IGNORE,\n  a row that duplicates an existing\n  UNIQUE index or PRIMARY KEY value in\n  the table causes a duplicate-key error\n  and the statement is aborted. With\n  IGNORE, the row still is not inserted,\n  but no error is issued. Data\n  conversions that would trigger errors\n  abort the statement if IGNORE is not\n  specified. With IGNORE, invalid values\n  are adjusted to the closest values and\n  inserted; warnings are produced but\n  the statement does not abort.</p>\n</blockquote>\n'}, {'answer_id': 73232, 'author': 'Aaron', 'author_id': 11176, 'author_profile': 'https://Stackoverflow.com/users/11176', 'pm_score': 2, 'selected': False, 'text': "<p>It sounds to me like you are trying to put too many bytes into a column. I ran across a very similar error with MySQL last night due to a bug in my code. I meant to do </p>\n\n<pre><code>foo.status = 'inactive'\n</code></pre>\n\n<p>but had actually typed</p>\n\n<pre><code>foo.state = 'inactive'\n</code></pre>\n\n<p>Where foo.state is supposed to be a two character code for a US State ( varchar(2) ). I got the same error as you. You might go look for a similar situation in your code.</p>\n"}, {'answer_id': 73397, 'author': 'Avi', 'author_id': 1605, 'author_profile': 'https://Stackoverflow.com/users/1605', 'pm_score': 4, 'selected': False, 'text': '<p>Check that your UTF-8 data is all 3-byte Unicode. If you have 4-byte characters (legal in Unicode and Java, illegal in MySQL 5), it can throw this error when you try to insert them. This is an <a href="http://bugs.mysql.com/bug.php?id=25666" rel="noreferrer">issue that should be fixed</a> in MySQL 6.0.</p>\n'}, {'answer_id': 1110486, 'author': 'Szemere', 'author_id': 136373, 'author_profile': 'https://Stackoverflow.com/users/136373', 'pm_score': 1, 'selected': False, 'text': '<p>I just hit this problem and solved it by removing all the non-standard ascii characters in my text (following the UTF-8 advice above).</p>\n\n<p>I had the problem on a Debian 4, Java 5 system; but the same code worked fine with Ubuntu 9.04, Java 6. Both run MySql 5.</p>\n'}, {'answer_id': 12914251, 'author': 'grigson', 'author_id': 1051262, 'author_profile': 'https://Stackoverflow.com/users/1051262', 'pm_score': 2, 'selected': False, 'text': '<p>In mysql you can use <code>MEDIUMTEXT</code> or <code>LONGTEXT</code> field type for large text data</p>\n'}]
['https://Stackoverflow.com/questions/73109', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']