morgon has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I am having problems inserting mysql TEXT-columns that exceed a size of around 70k using DBI/DBD::mysql on Ubuntu 10.04.

The error I get is "Data too long for column", so I assume I have set some connection-attribute to allow for larger column-sizes.

Does anybody know how to get around this?

Many thanks!

Replies are listed 'Best First'.
Re: inserting mysql TEXT-columns
by Corion (Patriarch) on Jan 31, 2011 at 13:59 UTC

    The length of 65536 bytes is a limitation of MySQL and not of Perl or the MySQL driver. You will need to recreate your table, most likely with the SQL type LONGTEXT instead of TEXT if you want to store more than 64k bytes per column.

      Corion is correct, however you can ALTER TABLE thus avoiding the need to recreate it entirely.

      print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
      Solved my problem.

      Thank you