Re: JDBC and inet type - Mailing list pgsql-general

From rob stone
Subject Re: JDBC and inet type
Date
Msg-id 1449229300.4000.3.camel@gmail.com
Whole thread Raw
In response to JDBC and inet type  (Tim Smith <randomdev4+postgres@gmail.com>)
List 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 by date:

Previous
From: "Peter J. Holzer"
Date:
Subject: Re: plperlu stored procedure seems to freeze for a minute
Next
From: Bill Moran
Date:
Subject: Re: JDBC and inet type