Re: JDBC and inet type

From: rob stone <floriparob(at)gmail(dot)com>
To: Tim Smith <randomdev4+postgres(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: JDBC and inet type
Date: 2015-12-04 11:41:40
Message-ID: 1449229300.4000.3.camel@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2015-12-04 12:17:58 Re: JDBC and inet type
Previous Message Peter J. Holzer 2015-12-04 10:15:34 Re: plperlu stored procedure seems to freeze for a minute