× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Todd,
I agree with Paul. You should probably be using a prepared statement for
this.

I'm willing to bet though that if you were to change 11/4/2008 to 11/04/2008
it would probably work. The issue with this would be if you ever change date
defaults you could have an issue. It's much better to create an actual date
object and let Java handle the conversion to the proper date format.

Hope this helps,
James R. Perkins


On Wed, Nov 5, 2008 at 7:16 AM, <TAllen@xxxxxxxxxxxx> wrote:

I am having trouble with a JDBC insert of a string into date or time
columns in a database table. The same command works fine from the SQL
green screen.
The insert statement fails with the "Data type mismatch" SQL exception.
The odd thing is that this only fails when the date or time does not have
all leading zeros.
Date of 11/14/2008 - success
Date of 11/4/2008 - error
Time of 22:00:00 - success
Time of 4:00:00 - error

The insert statement looks like this:

insert into myfile (cmdate, cmtime) values(cast('11/5/2008' as date),
cast('4:02:04' as time))

Thanks,
Todd



This communication and any transmitted documents are intended to be
confidential. If there is a problem with this transmission, please contact
the sender. If the reader of this message is not the intended recipient, or
the employee or agent responsible to deliver it to the intended recipient,
you are hereby notified that any dissemination, distribution or copying of
this communication is strictly prohibited.

--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.