Re: jdbc and automagic casting

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: jdbc and automagic casting
Дата
Msg-id alpine.BSO.2.00.1109191435330.603@leary.csoft.net
обсуждение исходный текст
Ответ на jdbc and automagic casting  (Guillaume <lomig42@gmail.com>)
Список pgsql-jdbc

On Mon, 19 Sep 2011, Guillaume wrote:

> INSERT INTO user_record (0, 'abc', '127.0.0.1') is valid and works.
> The string is automagically casted as an inet value.
>
> Using jdbc, this is not the case, and causes me loads of trouble (and
> exceptions).
> Is there a way around it?

If you are using setString with a parameter that's not a string, that's
not correct.  You should use instead setObject(x, y, Types.OTHER).

> I do not have access to the java source code, there is thus no way to
> update the code to programatically force a CAST.

Without access to the source code you can use the connection url parameter
stringtype=unspecified.

http://jdbc.postgresql.org/documentation/head/connect.html#connection-parameters

Kris Jurka

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

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: binary patch problems
Следующее
От: Jean-Max Reymond
Дата:
Сообщение: behavior at the end of a transaction