Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id C23FC9FB367 for ; Wed, 13 Jun 2007 02:58:37 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 06321-03 for ; Wed, 13 Jun 2007 02:58:32 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 8D82C9FB1FB for ; Wed, 13 Jun 2007 02:58:33 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from sprint2.tenix.com (sprint2.tenix.com [203.44.198.34]) by svr4.postgresql.org (Postfix) with ESMTP id 45B775AF02C for ; Wed, 13 Jun 2007 05:58:31 +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 l5D5wOiG031984 for ; Wed, 13 Jun 2007 15:58:24 +1000 Received: (from root@localhost) by sprint2.tenix.com (8.13.4/8.13.4/Submit) id l5D5wOl4031981 for pgsql-jdbc@postgresql.org; Wed, 13 Jun 2007 15:58:24 +1000 Date: Wed, 13 Jun 2007 15:58:24 +1000 Message-Id: <200706130558.l5D5wOl4031981@sprint2.tenix.com> Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C7AD7F.D4338260" Subject: Using INET types in prepared statements in Java? 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/43 X-Sequence-Number: 17105 This is a multi-part message in MIME format. ------_=_NextPart_001_01C7AD7F.D4338260 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 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_01C7AD7F.D4338260 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_01C7AD7F.D4338260--