pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: LITTLE Nelson <nelson.little@tenix.com>
To: pgsql-sql@postgresql.org
Subject: Using INET types in prepared statements
Date: Wed, 13 Jun 2007 12:03:12 +1000
Message-ID: <200706130203.l5D23Cs2026506@sprint2.tenix.com> (raw)

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

 

 


Disclaimer :
The contents of this e-mail including any attachments are intended only
for the person or entity to which this e-mail is addressed.  If you are not,
or believe you may not be, the intended recipient, please advise the sender
immediately by return e-mail, delete this e-mail and destroy any copies.
Tenix does not warrant nor guarantee that this email communication is free
from errors, virus, interception or interference.

view thread (2+ messages)  latest in thread

Message-ID: <200706130203.l5D23Cs2026506@sprint2.tenix.com>
Permalink:  ../200706130203.l5D23Cs2026506@sprint2.tenix.com/
Also on:    postgresql.org/message-id/200706130203.l5D23Cs2026506@sprint2.tenix.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: nelson.little@tenix.com
  Subject: Re: Using INET types in prepared statements
  In-Reply-To: <200706130203.l5D23Cs2026506@sprint2.tenix.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