Unix Technical Forum

Using INET types in prepared statements

This is a discussion on Using INET types in prepared statements within the pgsql Sql forums, part of the PostgreSQL category; --> Hi, I am trying to create a prepared statement in JAVA via JDBC and one of the parameters I ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Sql

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 03:28 PM
LITTLE Nelson
 
Posts: n/a
Default Using INET types in prepared statements

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.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 03:28 PM
Tom Lane
 
Posts: n/a
Default Re: Using INET types in prepared statements

"LITTLE Nelson" <nelson.little@tenix.com> writes:
> 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?


You'd probably get a more informed response on the pgsql-jdbc list.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:30 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com