From: Dave Cramer <pg@fastcrypt.com>
To: Djordje Nikolic <djordje@abanka.co.yu>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Prepared statement problem
Date: Wed, 25 Apr 2007 08:29:38 -0400
Message-ID: <F1AA1C86-3FA1-4392-B572-A0D596AC35B4@fastcrypt.com> (raw)
In-Reply-To: <462F3BE4.7080503@abanka.co.yu>
References: <462F3BE4.7080503@abanka.co.yu>
jdbc is using server side prepared statements.
As such the server won't allow this particular construct.
You can put the ? in for where something = ?
Dave
On 25-Apr-07, at 7:30 AM, Djordje Nikolic wrote:
> I had a problem with PreparedStatement which uses ? after FROM clause.
> Server reported org.postgresql.util.PSQLException: ERROR: syntax
> error at or near "$1"
>
> This is simplified example.
>
> PreparedStatement pstmt;
> try {
> pstmt = conn.prepareStatement("SELECT * FROM ?");
> pstmt.setString(1, "ps_nalog");
> pstmt.executeQuery();
> } catch (SQLException ex) {
> ex.printStackTrace();
> }
>
> Can anybody tell me where is posibble to put ? in a SELECT statement !
>
> best regards,
> Djordje Nikolic
>
> www.abanka.co.yu
>
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: pg@fastcrypt.com, djordje@abanka.co.yu
Subject: Re: Prepared statement problem
In-Reply-To: <F1AA1C86-3FA1-4392-B572-A0D596AC35B4@fastcrypt.com>
References: <462F3BE4.7080503@abanka.co.yu> <F1AA1C86-3FA1-4392-B572-A0D596AC35B4@fastcrypt.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox