X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A901D8BA11C for ; Tue, 15 Feb 2005 11:54:25 +0000 (GMT) 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 32200-01 for ; Tue, 15 Feb 2005 11:54:22 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id EDD3D8BA110 for ; Tue, 15 Feb 2005 11:54:20 +0000 (GMT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1D11HQ-0001TY-00; Wed, 16 Feb 2005 00:54:12 +1300 Message-ID: <4211E2E1.4090506@opencloud.com> Date: Wed, 16 Feb 2005 00:54:09 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Antony Paul Cc: pgsql-jdbc@postgresql.org Subject: Re: Pass column name in preparedstatement References: <2989532e050215032031e9aeb8@mail.gmail.com> In-Reply-To: <2989532e050215032031e9aeb8@mail.gmail.com> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/108 X-Sequence-Number: 12288 Antony Paul wrote: > Hi all, > Is it possible to pass column name to a PreparedStatement as a > parameter. No, you can only use parameter placeholders in places which the backend grammar allows parameters (namely, in expressions). Column names aren't one of those places. > Or should I use Statement. You can use either Statement or PreparedStatement so long as you insert the column name into the SQL query string yourself before giving it to the driver. -O