Liu 刘 Yan 研 wrote:
> I can't get a 'null' value of Java data type if
> the field is NULL
>
> // ------------------------
> // Environment
> .MySQL Server: 4.1.10-nt
> .Connector/J: 3.1.7
> .Web Server: Tomcat 5.5.7
> .JDK: Sun JDK 5.0 Update 1
>
> // ------------------------
> // Schema
> CREATE TABLE `user_patient` (
> `PatientID` int(10) unsigned NOT NULL
> auto_increment,
> `BreakfastTime` time default NULL,
> PRIMARY KEY (`PatientID`)
> ) ENGINE=InnoDB DEFAULT CHARSET=gbk
> COMMENT='用户-患者 关系表';
>
> // ------------------------
> // the API spec of java.sql.ResultSet
>
> Time getTime(String columnName)
> throws SQLExceptionRetrieves the
> value of the designated column in the current row
> of this ResultSet object as a java.sql.Time object
> in the Java programming language.
> Parameters:columnName - the SQL name of the column
> Returns:the column value; if the value is SQL
> NULL, the value returned is null Throws:
> SQLException - if a database access error occurs
This is a known issue, fixed for 3.1.8. You can use a nightly snapshot build of 3.1 from
http://downloads.mysql.com/snapshots.php until 3.1.8 is released.
-Mark
Mark Matthews
Consulting Member Technical Staff - MySQL Enterprise Tools
Oracle
http://www.mysql.com/products/enterprise/monitor.html