Re: getTime() throws NullPointerException if the field is NULL
Posted by: Mark Matthews
Date: March 06, 2005 04:33PM

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

Options: ReplyQuote


Subject
Written By
Posted
Re: getTime() throws NullPointerException if the field is NULL
March 06, 2005 04:33PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.