pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedbug report: preparedStatement.setObject(indx, "2004-August-15", java.sql.Types.DATE) generates number format exception
2+ messages / 2 participants
[nested] [flat]
* bug report: preparedStatement.setObject(indx, "2004-August-15", java.sql.Types.DATE) generates number format exception
@ 2007-02-14 19:03 Floyd Shackelford <shackman@fwshackelford.com>
2007-02-14 19:36 ` Re: bug report: preparedStatement.setObject(indx, "2004-August-15", java.sql.Types.DATE) generates number format exception Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 2+ messages in thread
From: Floyd Shackelford @ 2007-02-14 19:03 UTC (permalink / raw)
To: pgsql-jdbc
bug report:
postgresql: 8.2.0
jdbc: postgresql-8.2-504.jdbc3.jar
the following generates a number format exception:
preparedStatement.setObject(indx,"2004-August-15",java.sql.Types.DATE)
the following works:
preparedStatement.setObject(indx,"2004-08-15",java.sql.Types.DATE)
i prefer to use the former.
--
Soli Deo gloria,
Floyd Shackelford
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: bug report: preparedStatement.setObject(indx, "2004-August-15", java.sql.Types.DATE) generates number format exception
2007-02-14 19:03 bug report: preparedStatement.setObject(indx, "2004-August-15", java.sql.Types.DATE) generates number format exception Floyd Shackelford <shackman@fwshackelford.com>
@ 2007-02-14 19:36 ` Kris Jurka <books@ejurka.com>
0 siblings, 0 replies; 2+ messages in thread
From: Kris Jurka @ 2007-02-14 19:36 UTC (permalink / raw)
To: Floyd Shackelford <shackman@fwshackelford.com>; +Cc: pgsql-jdbc
On Wed, 14 Feb 2007, Floyd Shackelford wrote:
> the following generates a number format exception:
> preparedStatement.setObject(indx,"2004-August-15",java.sql.Types.DATE)
>
> the following works:
> preparedStatement.setObject(indx,"2004-08-15",java.sql.Types.DATE)
>
> i prefer to use the former.
>
I'm not sure that's actually a bug as there are many, many possible date
formats and the JDBC spec doesn't specify what conversions must be
supplied. Do you use this same code on other databases?
Using a SimpleDateFormat object to convert from String to Date yourself is
the most portable and guaranteed correct method.
Kris Jurka
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2007-02-14 19:36 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-02-14 19:03 bug report: preparedStatement.setObject(indx, "2004-August-15", java.sql.Types.DATE) generates number format exception Floyd Shackelford <shackman@fwshackelford.com>
2007-02-14 19:36 ` Kris Jurka <books@ejurka.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox