AvoidMySQL5DataTruncationErrors

MySQL 5 can run in strict mode, which causes errors to be thrown instead of warnings when data truncation occurs (see mysql bug 14048).

 

Errors may look similar to this:

 

11:16:36,520 ERROR JDBCExceptionReporter Data truncation: Data too long for column 'jbp_viewrealemail' at row 1

 

While MySQL 5 is not yet supported, there is a way to prevent the error from being thrown during the installation of the portal:

 

  1. If you have MySQL 5 installed already and running in strict mode, edit the my.ini (or my.cfg) file of MySQL and remove the "STRICT_TRANS_TABLES" part from the line: sql-mode=STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

  2. Add "jdbcCompliantTruncation=false" in your datasource descriptor file (-ds.xml) under the deploy directory. Your connection URL should look like: <connection-url>jdbc:mysql://your-host-name:3306/jbossportal?useServerPrepStmts=false&amp;amp;jdbcCompliantTruncation=false</connection-url>

 

This should prevent any further data truncation related errors during the portal installation.