- 论坛徽章:
- 0
|
bin/mysqladmin Ver 8.41 Distrib 5.0.45, for pc-linux-gnu on i686
Copyright (C) 2000-2006 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 5.0.45
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 29 sec
Threads: 1 Questions: 1 Slow queries: 0 Opens: 12 Flush tables: 1 Open tables: 6 Queries per second avg: 0.034
默认值和mode或多或少有些关系! MySQL manual 上说:“Prior to MySQL 5.0.2, .............................BLOB and TEXT columns cannot be assigned a default value. ”
我或许找到先前的原因了, java-connector中对数据库的默认模式是strict mode, 某个不符合5.0.2以后版本规范的语句,在还没有被数据库执行以前,就被java-connector 抛出异常了, 这是我猜的。 下面是MySQL manual的摘抄, :
http://dev.mysql.com/doc/refman/5.0/en/data-type-defaults.html
As of MySQL 5.0.2, if a column definition includes no explicit DEFAULT value, MySQL determines the default value as follows:
If the column can take NULL as a value, the column is defined with an explicit DEFAULT NULL clause. This is the same as before 5.0.2.
If the column cannot take NULL as the value, MySQL defines the column with no explicit DEFAULT clause. For data entry, if an INSERT or REPLACE statement includes no value for the column, MySQL handles the column according to the SQL mode in effect at the time:
If strict SQL mode is not enabled, MySQL sets the column to the implicit default value for the column data type.
If strict mode is enabled, an error occurs for transactional tables and the statement is rolled back. For non-transactional tables, an error occurs, but if this happens for the second or subsequent row of a multiple-row statement, the preceding rows will have been inserted.
[ 本帖最后由 cnxiao 于 2007-8-18 12:07 编辑 ] |
|