From: Thomas Burdairon <tburdairon@entelience.com>
To: LITTLE Nelson <nelson.little@tenix.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Using INET types in prepared statements in Java?
Date: Wed, 13 Jun 2007 09:20:15 +0200
Message-ID: <43898107-CFD1-422F-8AD9-24AAA20F1B01@entelience.com> (raw)
In-Reply-To: <200706130558.l5D5wOl4031981@sprint2.tenix.com>
References: <200706130558.l5D5wOl4031981@sprint2.tenix.com>
On Jun 13, 2007, at 07:58, LITTLE Nelson wrote:
> Hi,
>
>
>
> I am trying to create a prepared statement in JAVA via JDBC and one
> of the parameters I need to set in the SQL statement is of type
> INET. As there is no setInet() method how do I pass in the INET
> value into the sql statement?
>
>
>
> I have tried this:
>
>
>
> " WHERE b.ip = ?::inet"
>
>
>
> But I get “org.postgresql.util.PSQLException: ERROR: cannot cast
> type character varying to inet”
>
>
>
> I also tried
>
> " WHERE b.ip = ?"
>
>
>
> And I get “org.postgresql.util.PSQLException: ERROR: cannot cast
> type character varying to inet”
>
>
>
> I really want to use prepared statement as I have to run this SQL
> statement over and over and it is supposed to be more efficient.
>
>
>
> Can anyone help?
>
>
>
> Cheers,
>
> Nelson
>
>
>
>
Hy Nelson
Did you try
" WHERE b.ip = inet(?)"
Thomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: tburdairon@entelience.com, nelson.little@tenix.com
Subject: Re: Using INET types in prepared statements in Java?
In-Reply-To: <43898107-CFD1-422F-8AD9-24AAA20F1B01@entelience.com>
References: <200706130558.l5D5wOl4031981@sprint2.tenix.com> <43898107-CFD1-422F-8AD9-24AAA20F1B01@entelience.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox