Link to home
Start Free TrialLog in
Avatar of sudhakar_koundinya
sudhakar_koundinya

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of bloodredsun
bloodredsun
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sudhakar_koundinya
sudhakar_koundinya

ASKER

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
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.
I have done a silly mistake.  I haven't seen other table data. It is set to 0000-00-00

Take your points :)
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'
Guys,

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

Thanks
Sudhakar
>>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...
I worked on a small JSF project and read up on it.  Ask away!