Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 494149FB1D9 for ; Tue, 12 Jun 2007 23:35:38 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 16786-09 for ; Tue, 12 Jun 2007 23:35:28 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id D28B39FB72A for ; Tue, 12 Jun 2007 23:35:33 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from sprint2.tenix.com (unknown [203.44.198.34]) by svr4.postgresql.org (Postfix) with ESMTP id E73CC5AF02C for ; Wed, 13 Jun 2007 02:03:20 +0000 (GMT) Received: from sprint2.tenix.com (localhost [127.0.0.1]) by sprint2.tenix.com (8.13.4/8.13.4/Debian-3sarge1) with ESMTP id l5D23ChL026509 for ; Wed, 13 Jun 2007 12:03:12 +1000 Received: (from root@localhost) by sprint2.tenix.com (8.13.4/8.13.4/Submit) id l5D23Cs2026506 for pgsql-sql@postgresql.org; Wed, 13 Jun 2007 12:03:12 +1000 Date: Wed, 13 Jun 2007 12:03:12 +1000 Message-Id: <200706130203.l5D23Cs2026506@sprint2.tenix.com> Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C7AD5E.F26C9EA0" Subject: Using INET types in prepared statements X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "LITTLE Nelson" To: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=BAYES_50=0.001, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200706/83 X-Sequence-Number: 28573 This is a multi-part message in MIME format. ------_=_NextPart_001_01C7AD5E.F26C9EA0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Hi, =20 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?=20 =20 I have tried this: =20 " WHERE b.ip =3D ?::inet" =20 But I get "org.postgresql.util.PSQLException: ERROR: cannot cast type character varying to inet" =20 I also tried " WHERE b.ip =3D ?" =20 And I get "org.postgresql.util.PSQLException: ERROR: cannot cast type character varying to inet" =20 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.=20 =20 Can anyone help? =20 Cheers, Nelson =20 =20 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. ------_=_NextPart_001_01C7AD5E.F26C9EA0 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

Hi,

 

I am trying to create a prepared statement in JAVA via J= DBC and one of the parameters I need to set in the SQL statement is of type INE= T. 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 =3D ?::inet&qu= ot;

 

But I get “org.postgresql.util.PSQLException: ERRO= R: cannot cast type character varying to inet”<= /p>

 

I also tried

"     WHERE b.ip =3D ?"

 

And I get “org.postgresql.util.PSQLException: ERRO= R: cannot cast type character varying to inet”<= /p>

 

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. <= o:p>

 

Can anyone help?

 

Cheers,

Nelson

 

 

------_=_NextPart_001_01C7AD5E.F26C9EA0--