getTime() throws NullPointerException if the field is NULL
Posted by: Liu 刘 Yan 研
Date: March 05, 2005 10:43PM

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

Options: ReplyQuote


Subject
Written By
Posted
getTime() throws NullPointerException if the field is NULL
March 05, 2005 10:43PM


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.