java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Date

Hi

While working with mysql and JSF,I got the exception. how to resolve this??

Thanks
Sudhakar
LVL 14
sudhakar_koundinyaAsked:
Who is Participating?
 
bloodredsunCommented:
From the MySQL docs:

"TIMESTAMP values may range from the beginning of 1970 to partway through the year 2037, with a resolution of one second"

Therefore you can't set it for Midnight 0000AD.
0
 
sudhakar_koundinyaAuthor Commented:
But my date is set to 2005-05-05

I am not getting any exception in first page. while navigating to second page I am getting this error
jiya_providerRowSet.setDataSourceName("java:comp/env/jdbc/jiya");
            jiya_providerRowSet.setCommand("SELECT ALL JIYA_USER.USER_ID, JIYA_USER.LOGIN_ID, JIYA_USER.USER_FNAME, JIYA_USER.USER_LNAME, JIYA_USER.USER_ADDRRESS1, JIYA_USER.USER_ADDRRESS2, JIYA_USER.USER_CITY, JIYA_USER.USER_ZIPCODE, JIYA_USER.USER_HOMEPHONE, JIYA_USER.USER_WORKPHONE, JIYA_USER.USER_MOBILEPHONE, JIYA_USER.USER_FAX, JIYA_USER.USER_PAGER, JIYA_USER.USER_CREATED_DATE, JIYA_USER.LAST_ACCESSED_DATE, STATE.STATE_NAME, PROVIDER.PROVIDER_DRIVER_LICENSE, PROVIDER.PROVIDER_DRIVER_LICENSE_ISSUE_DATE, PROVIDER.PROVIDER_DRIVER_LICENSE_EXPIRY_DATE, PROVIDER.PROVIDER_SSN  FROM JIYA_USER INNER JOIN STATE ON JIYA_USER.USER_STATE_ID=STATE.STATE_ID, PROVIDER WHERE PROVIDER.PROVIDER_ID=JIYA_USER.USER_ID WHERE JIYA_USER.USER_ID=1");

Regards
Sudhakar
0
 
bloodredsunCommented:
There seems to be a fair amount on google for this. It appears that if you are trying to set an empty value it will throw this error.

Looks like you need to validate the date before entry.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
sudhakar_koundinyaAuthor Commented:
I have done a silly mistake.  I haven't seen other table data. It is set to 0000-00-00

Take your points :)
0
 
MogalManicCommented:
You probably have dates in the database that are 00/00/0000 00:00:00 which cannot be represented in Java.  Issue a Update statement that changes them to null:

  Update table set dateField = null
  where dateField = '00/00/00 00:00:00'
0
 
sudhakar_koundinyaAuthor Commented:
Guys,

Do you have any working knowledge on Java Server Faces. So that I can ask some questions on JSF??

Thanks
Sudhakar
0
 
bloodredsunCommented:
>>Take your points :)

Thanks. It was probably one of those things that we all do from time to time :-)

>>Do you have any working knowledge on Java Server Faces. So that I can ask some questions on JSF??

only in prototyping stuff. Most of the stuff I do is in Struts, JSTL and other jakarta projects...
0
 
MogalManicCommented:
I worked on a small JSF project and read up on it.  Ask away!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.