Re: Throwing NumberFormat exception for preparedStatement.setObjcet()

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: Throwing NumberFormat exception for preparedStatement.setObjcet()
Дата
Msg-id alpine.BSO.2.00.1001131733040.3231@leary.csoft.net
обсуждение исходный текст
Ответ на Re: Throwing NumberFormat exception for preparedStatement.setObjcet()  (Dave Cramer <pg@fastcrypt.com>)
Ответы Re: Throwing NumberFormat exception for preparedStatement.setObjcet()  (Srinivas Gunnam <srinivas_gunnam@persistent.co.in>)
Список pgsql-jdbc

On Tue, 12 Jan 2010, Dave Cramer wrote:

> If I were writing it I would use java.sql.Types.Integer as the
> columnType, not the numeric value. And inputData should be an Integer.
>

inputData can perfectly well be a String.  That's the whole point of the
three argument version of this method, to provide such a conversion for
the user.

The reason it's throwing a NumberFormatException is that you're passing
something which isn't a number.  With a later driver version you wouldn't
get this exception, but instead the server would complain that it wasn't a
valid number.

The attached test case shows this working just fine from my perspective.

Kris Jurka

Вложения

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

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: Throwing NumberFormat exception for preparedStatement.setObjcet()
Следующее
От: Racker Vijay
Дата:
Сообщение: Re: Best Practice to Create a Connection Pool in PostgreSQL