X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 29E66D9632 for ; Mon, 21 Nov 2005 06:09:28 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95068-05 for ; Mon, 21 Nov 2005 10:09:29 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) by svr1.postgresql.org (Postfix) with ESMTP id 61EB6D6E94 for ; Mon, 21 Nov 2005 06:09:25 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 69so870829wri for ; Mon, 21 Nov 2005 02:09:27 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=Gdiy+tqICU4HAg8S8WA2hiQzuMkFsRIfu+Vu6PA586w65zLygmHCgczEfntIUz2qGy8mEIwoQjiQ62+SXcZIYVDbraOJEMTwGoFfmsmNT60ltay3Ga259o6axtYFZM7t87UlsH2wrkTI653i6M4J2StUxdFacyagQUyiaZ9pCY0= Received: by 10.54.81.1 with SMTP id e1mr112421wrb; Mon, 21 Nov 2005 02:09:27 -0800 (PST) Received: from tirza.domain ( [222.124.237.24]) by mx.gmail.com with ESMTP id 11sm3064151wrl.2005.11.21.02.09.25; Mon, 21 Nov 2005 02:09:27 -0800 (PST) From: Tjioe Ai Xin To: pgsql-jdbc@postgresql.org Subject: Can PostgreSQL do data type automated casting in prepared statement? Date: Mon, 21 Nov 2005 17:18:26 +0700 User-Agent: KMail/1.8 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200511211718.26679.xinxincute@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/134 X-Sequence-Number: 14232 Dear all, I already used PostgreSQL from version 7.3.3. So far, I have no problem about using prepared statement especially in data= type. =46rom Mr. Kris Jurka I got answer that it because of different data type w= hen I try to cast them. >I'm guessing you are using PreparedStatement.setString for a numeric=20 >value. =A0Do you have a query like "WHERE colname / ? " ? =A0You need to u= se a=20 >different setXXX method that takes a numeric value. My code is like this: I have query: "Select count(*) / paramPage from tblFirst where condition"; The paramPage were filled from parameter which I specified as string data t= ype. So I using setString method for my prepared statement for passing paramPage= value. When I'm using the old jdbc driver pg74jdbc3.jar, I got no problem at all. But when I try to upgrade my PostgreSQL to 8.0.3. I got problem data type e= rror. Can PostgreSQL do data type automated casting in prepared statement again?= =20 So I do not need change my code :) Thanks in advance. Best Regards, Xin Xin