I'm writing a String into a database which has a field of type TEXT. This means I can write 65,535 bytes into that field. After that I will get a SQL Exception:
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'DETAILS' at row 1
So my question is now, how can I check my String and then also how can I cut the String at the correct position that it still fits into the database.
I know it depends also on the encoding. I just saw that the MySQL schema uses the "latin1 - default collection" charset.