Re: bug report: preparedStatement.setObject(indx,"2004-August-15",java.sql.Types.DATE) generates number format exception

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: bug report: preparedStatement.setObject(indx,"2004-August-15",java.sql.Types.DATE) generates number format exception
Дата
Msg-id Pine.BSO.4.64.0702141433300.24142@leary.csoft.net
обсуждение исходный текст
Ответ на bug report: preparedStatement.setObject(indx,"2004-August-15",java.sql.Types.DATE) generates number format exception  (Floyd Shackelford <shackman@fwshackelford.com>)
Список 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


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "Chris Gamache"
Дата:
Сообщение: Re: stringtype=unspecified problem
Следующее
От: Jeffrey Cox
Дата:
Сообщение: Re: getProcedureColumns