Forums Register Login

JDBC and null dates

+Pie Number of slices to send: Send
When inserting a record from my jsp page into Sybase my date is displayed as Wed Dec 31 16:00:00 PST 1969. The date field is blank on my jsp page but the database requires a value on insert. I am using the pPreparedStatement ps.setNull(1,java.sql.Types.Date) I really want the date to be null in the database. How can I get past this value being displayed in the database?
Thanks.
+Pie Number of slices to send: Send
Chuck
If the database table is set up not to accept null values for that particular column then you'll have to find some other way around it (or have the schema of the DB changed). Maybe insert a value that you know wont be entered in normal use to represent null ?
+Pie Number of slices to send: Send
Thanks Dave. I'll go for inserting a value that can't be used for normal business.
Opportunity is missed by most people because it is dressed in overalls and looks like work - Edison. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 971 times.
Similar Threads
Resultset based on current Date and Time
problem insering date value in database
Converting "Mon Nov 24 00:00:00 EST 2008" pattern to "dd/MM/yyyy" pattern
Date Format
Date Formatting
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 05:23:17.