Skip site navigation (1) Skip section navigation (2)

Re: Using INET types in prepared statements in Java?

From: Thomas Burdairon <tburdairon(at)entelience(dot)com>
To: LITTLE Nelson <nelson(dot)little(at)tenix(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Using INET types in prepared statements in Java?
Date: 2007-06-13 07:20:15
Message-ID: 43898107-CFD1-422F-8AD9-24AAA20F1B01@entelience.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
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



In response to

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2007-06-13 07:27:53
Subject: Re: Error reporting issue in SimpleParameterList
Previous:From: Achilleas MantziosDate: 2007-06-13 06:59:23
Subject: Re: Using INET types in prepared statements in Java?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group