开发者

MySQl 5.5 doesn't truncate VARCHARs when they're longer than expected

I've this problem: before 5.5 mySQL (using myISAM tables) used to truncate VARCHAR types to the column length. Now, starting with the abovementioned version, it doesn't anymore. It's a huge problem as it breaks my app (I know there shouldn't be such problem, but I didn't do that... I just have to cope with it, so please be pat开发者_如何学编程ient). Is there a way to set this behaviour in 5.5?

I tried to set SQL-MODE = "STRICT_TRANS_TABLES" as I read somewhere it would help... It doesn't....

I even suspect I can solve this by setting some parameter in the JDBC driver I'm using, yeah, sorry it's a java app, I forgot...

Please help !


What SQL_MODE are you using? Is it the same one you used before upgrading to 5.5? I suspect it is not.

I'm running 5.5.8 with SQL_MODE = '' and the implicit truncation still works the same as it did in older versions (5.0, 5.1, etc.)

So I suspect your problem is that you changed SQL_MODE, not that you upgraded to 5.5.

Check current SQL_MODE:

SELECT @@SQL_MODE;

Set SQL_MODE to '':

SET SQL_MODE = '';


The problem was in a parameter of JDBC driver. In fact it was set to throw exceptions in case of truncation. Changing the configuration solved it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜