pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Using INET types in prepared statements in Java?
3+ messages / 3 participants
[nested] [flat]

* Using INET types in prepared statements in Java?
@ 2007-06-13 05:58 LITTLE Nelson <nelson.little@tenix.com>
  2007-06-13 06:59 ` Re: Using INET types in prepared statements in Java? Achilleas Mantzios <achill@matrix.gatewaynet.com>
  2007-06-13 07:20 ` Re: Using INET types in prepared statements in Java? Thomas Burdairon <tburdairon@entelience.com>
  0 siblings, 2 replies; 3+ messages in thread

From: LITTLE Nelson @ 2007-06-13 05:58 UTC (permalink / raw)
  To: pgsql-jdbc

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.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Using INET types in prepared statements in Java?
  2007-06-13 05:58 Using INET types in prepared statements in Java? LITTLE Nelson <nelson.little@tenix.com>
@ 2007-06-13 06:59 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Achilleas Mantzios @ 2007-06-13 06:59 UTC (permalink / raw)
  To: pgsql-jdbc

Óôéò ÔåôÜñôç 13 Éïýíéïò 2007 08:58, ï/ç LITTLE Nelson Ýãñáøå:
> 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"

Did you try

WHERE b.ip = ?::text::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.

-- 
Achilleas Mantzios



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Using INET types in prepared statements in Java?
  2007-06-13 05:58 Using INET types in prepared statements in Java? LITTLE Nelson <nelson.little@tenix.com>
@ 2007-06-13 07:20 ` Thomas Burdairon <tburdairon@entelience.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Thomas Burdairon @ 2007-06-13 07:20 UTC (permalink / raw)
  To: LITTLE Nelson <nelson.little@tenix.com>; +Cc: 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

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2007-06-13 07:20 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-06-13 05:58 Using INET types in prepared statements in Java? LITTLE Nelson <nelson.little@tenix.com>
2007-06-13 06:59 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
2007-06-13 07:20 ` Thomas Burdairon <tburdairon@entelience.com>

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