Re: JDBC and inet type

Поиск
Список
Период
Сортировка
От rob stone
Тема Re: JDBC and inet type
Дата
Msg-id 1449229300.4000.3.camel@gmail.com
обсуждение исходный текст
Ответ на JDBC and inet type  (Tim Smith <randomdev4+postgres@gmail.com>)
Список pgsql-general
On Fri, 2015-12-04 at 09:41 +0000, Tim Smith wrote:
> Hi,
>
> When I use "preparedStatement.setString(5,ip);" to send values to a
> stored function, it obviously gets sent to postgres as "character
> varying".
>
> Postgres obviously complains loudly and says " Hint: No function
> matches the given name and argument types. You might need to add
> explicit type casts.".
>
> What is the appropriate workaround ?
>
> Thanks!
>
> Tim
>
>

"preparedStatement.setString(5,ip);" will set parameter number five to
the string held in the variable.
That's what setString does. It expects a string to be passed.
Your function's fifth IN argument needs to be defined as a "string".
Within the function you will have to cast it to inet.

HTH,

Rob


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

Предыдущее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: plperlu stored procedure seems to freeze for a minute
Следующее
От: Bill Moran
Дата:
Сообщение: Re: JDBC and inet type