patternsqlMinor
Data too long for column for longtext datatype - MySqlException
Viewed 0 times
longtextdatatypecolumnmysqlexceptionlongtoofordata
Problem
I am trying to insert string in
Throws an exception
MySQL document state that LONGTEXT can contains maximum 4GB of data
Any suggestion will be welcome
UPDATE:
Exception occurs when characters length is greater than 65535
But 65536 is a max length of
LONGTEXT column. Length of string is 75402 and byte count is 150804 (about 147 KB)Throws an exception
Data too long for column On inserting record. MySQL document state that LONGTEXT can contains maximum 4GB of data
Any suggestion will be welcome
UPDATE:
Exception occurs when characters length is greater than 65535
But 65536 is a max length of
TEXT datatype and I am using LONGTEXT here.Solution
http://dev.mysql.com/doc/refman/5.7/en/string-type-overview.html
LONGTEXT [CHARACTER SET charset_name] [COLLATE collation_name]
A TEXT column with a maximum length of 4,294,967,295 or 4GB (232 − 1)
characters. The effective maximum length is less if the value contains
multibyte characters. The effective maximum length of LONGTEXT columns
also depends on the configured maximum packet size in the
client/server protocol and available memory. Each LONGTEXT value is
stored using a 4-byte length prefix that indicates the number of bytes
in the value.
http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_max_allowed_packet
http://dev.mysql.com/doc/refman/5.7/en/memory-use.html
LONGTEXT [CHARACTER SET charset_name] [COLLATE collation_name]
A TEXT column with a maximum length of 4,294,967,295 or 4GB (232 − 1)
characters. The effective maximum length is less if the value contains
multibyte characters. The effective maximum length of LONGTEXT columns
also depends on the configured maximum packet size in the
client/server protocol and available memory. Each LONGTEXT value is
stored using a 4-byte length prefix that indicates the number of bytes
in the value.
http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_max_allowed_packet
http://dev.mysql.com/doc/refman/5.7/en/memory-use.html
Context
StackExchange Database Administrators Q#157997, answer score: 2
Revisions (0)
No revisions yet.