Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 5D2599FB85A for ; Wed, 13 Jun 2007 03:59:33 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 62511-02 for ; Wed, 13 Jun 2007 03:59:30 -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 4D8F99FB367 for ; Wed, 13 Jun 2007 03:59:30 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from smadev.internal.net (host3.dynacom.ondsl.gr [62.103.35.211]) by svr4.postgresql.org (Postfix) with ESMTP id 2C4605AF88D for ; Wed, 13 Jun 2007 06:59:28 +0000 (GMT) Received: from smadev.internal.net (localhost [127.0.0.1]) by smadev.internal.net (8.13.6/8.13.6) with ESMTP id l5D6xOYB034980 for ; Wed, 13 Jun 2007 09:59:24 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) Received: by smadev.internal.net (8.13.6/8.13.6/Submit) id l5D6xOWi034979 for pgsql-jdbc@postgresql.org; Wed, 13 Jun 2007 09:59:24 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) From: Achilleas Mantzios Organization: Dynacom Tankers Mgmt To: pgsql-jdbc@postgresql.org Subject: Re: Using INET types in prepared statements in Java? Date: Wed, 13 Jun 2007 09:59:23 +0300 User-Agent: KMail/1.9.3 References: <200706130558.l5D5wOl4031981@sprint2.tenix.com> In-Reply-To: <200706130558.l5D5wOl4031981@sprint2.tenix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-7" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200706130959.23766.achill@matrix.gatewaynet.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.023 tagged_above=0 required=5 tests=AWL=-0.113, BAYES_50=0.001, FORGED_RCVD_HELO=0.135 X-Spam-Level: X-Archive-Number: 200706/44 X-Sequence-Number: 17106 =D3=F4=E9=F2 =D4=E5=F4=DC=F1=F4=E7 13 =C9=EF=FD=ED=E9=EF=F2 2007 08:58, =EF= /=E7 LITTLE Nelson =DD=E3=F1=E1=F8=E5: > 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 =3D ?::inet" Did you try WHERE b.ip =3D ?::text::inet" ? > > > > But I get "org.postgresql.util.PSQLException: ERROR: cannot cast type > character varying to inet" > > > > I also tried > > " WHERE b.ip =3D ?" > > > > 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. =2D-=20 Achilleas Mantzios