Re: Throwing NumberFormat exception for preparedStatement.setObjcet()

Поиск
Список
Период
Сортировка
От Srinivas Gunnam
Тема Re: Throwing NumberFormat exception for preparedStatement.setObjcet()
Дата
Msg-id 14B8F27D7CE40C4C9E481B2B845C2E0D72591007@EXCHANGE.persistent.co.in
обсуждение исходный текст
Ответ на Re: Throwing NumberFormat exception for preparedStatement.setObjcet()  (Kris Jurka <books@ejurka.com>)
Список pgsql-jdbc
Thanks all, Problem resolved :)

-----Original Message-----
From: Kris Jurka [mailto:books@ejurka.com]
Sent: Thursday, January 14, 2010 4:07 AM
To: Dave Cramer
Cc: Srinivas Gunnam; pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Throwing NumberFormat exception for preparedStatement.setObjcet()



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

DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is
intendedonly for the use of the individual or entity to which it is addressed. If you are not the intended recipient,
youare not authorized to read, retain, copy, print, distribute or use this message. If you have received this
communicationin error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not
acceptany liability for virus infected mails. 

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

Предыдущее
От: Racker Vijay
Дата:
Сообщение: Re: Best Practice to Create a Connection Pool in PostgreSQL
Следующее
От: Mirco Attocchi
Дата:
Сообщение: