hi,
I have a table where one of the column is a date.
I am able to get the value entered in the textfield
and insert the value in database using preparedStatement
and setDate(). If the value entered in the texfield is
empty, it enters '0000-00-00' as default in the database.
The problem is I'm not able to retrieve the value for
the date field if the textfield was empty. How do I
test for null values? When I use if(res.getDate(5) == null)
after the query to test for null values I get the exception:
Value '0000-00-00' can not be represented as java.sql.Date
Please help
I'm using mysql 4.0.25 and msql-Connector-java-3.0.11
My create table looks like this:
CREATE TABLE CandidateStatus ( StatusID INT NOT NULL AUTO_INCREMENT
, ResumeID INT NOT NULL REFERENCES
Resumes(ResumeID) ON DELETE CASCADE
, RecruiterName VARCHAR(96) CHECK (RecruiterName IS NOT
NULL)
, Submitted_to_Client VARCHAR(96) DEFAULT ''
, Submission_Date DATE DEFAULT '0000-00-00'
, Submission_Status VARCHAR(20) DEFAULT ''
, PerHourCost INT DEFAULT 0
, PerHourRatePresented INT DEFAULT 0
, PRIMARY KEY (StatusID)
, FOREIGN KEY (ResumeID) REFERENCES Resumes(ResumeID)
);