在路上 ……

Linux系统运维与架构

转帖自http://www.blogjava.net/hilor/articles/164814.html

在使用MySql 时, 数据库中的字段类型是timestamp的,默认为0000-00-00, 会发生异常:

java.sql.SQLException:   Value   '0000-00-00 '   can   not   be   represented   as   java.sql.Timestamp 

解决办法:

给jdbc url加上 zeroDateTimeBehavior参数:

datasource.url=jdbc:mysql://localhost:3306/testdb?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true 

zeroDateTimeBehavior=round是为了指定MySql中的DateTime字段默认值查询时的处理方式;默认是抛出异常,

对于值为0000-00-00 00:00:00(默认值)的纪录,如下两种配置,会返回不同的结果:

zeroDateTimeBehavior=round   0001-01-01   00:00:00.0 

zeroDateTimeBehavior=convertToNull   null

Extmail系统,webmail登陆后查看收件箱,提示

Can't call method "tie" on an undefined value at /usr/local/www/extmail/libs/Ext/DB.pm line 90.

可能是由于目录的缓存数据文件有问题造成的。删除该用户maildir目录下的extmail-curcache.db文件即可。


网上看了N种方法,但是一一试验过,都无效或临时有效

最终找到一个终极解决办法,比较好使。

修改文件描述符限制(root用户下):

#vi  /etc/security/limits.conf在最下面添加一行
*               -       nofile          65530

这里我改了个比较大的数65530,可以自己根据实际需要改为合适的值。


Typecho 强力驱动