I have a field as follows in MySQL: Type: Text Length: 0 Decimals: 0
And when I try to insert data around the size of 4 pages of MS Word, Coldfusion errors with: Data Too Long from the DB.
I thought TEXT data type was able to expand and handle this size of data? What am I missing and what can I do?
TEXT: 65,535 characters - 64 KB The standard TEXT data object is sufficiently capable of handling typical long-form text content. TEXT data objects top out at 64 KB (expressed as 2^16 -1) or 65,535 characters and requires a 2 byte overhead.
That error message means you are inserting a value that is greater than the defined maximum size of the column. The solution to resolve this error is to update the table and change the column size.
The four TEXT types are TINYTEXT , TEXT , MEDIUMTEXT , and LONGTEXT . These correspond to the four BLOB types and have the same maximum lengths and storage requirements.
TEXT has a maximum length of 65,535 bytes—the same as VARCHAR. MEDIUMTEXT has a maximum length of about 16 megabytes. LONGTEXT has a maximum length of about 4 gigabytes.
The type TEXT
is limited to 2^16
bytes, or 65536 bytes. Try using the type LONGTEXT
instead. It can hold values up to 2^32
bytes in length.
Text extracted from:
MySQL 5.1 Reference Manual :: 10 Data Types :: 10.1 Data Type Overview :: 10.1.3 Overview of String Types
TEXT[(M)] [CHARACTER SET charset_name] [COLLATE collation_name] A TEXT column with a maximum length of 65,535 (2^16 – 1) characters.
The effective maximum length is less if the value contains multi-byte characters. Each TEXT value is stored using a two-byte length prefix that indicates the number of bytes in the value.
An optional length M can be given for this type. If this is done, MySQL creates the column as the smallest TEXT type large enough to hold values M characters long.
I think you'd better use BLOB for that column.
MySQL 5.0 Reference Manual :: 10 Data Types :: 10.4 String Types :: 10.4.3 The BLOB and TEXT Types
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With