Skip site navigation (1) Skip section navigation (2)

Re: Prepared statement problem

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Djordje Nikolic <djordje(at)abanka(dot)co(dot)yu>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Prepared statement problem
Date: 2007-04-25 12:29:38
Message-ID: F1AA1C86-3FA1-4392-B572-A0D596AC35B4@fastcrypt.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
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


In response to

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2007-04-25 19:37:58
Subject: Re: Question for the XAConnections default autocommit state
Previous:From: Djordje NikolicDate: 2007-04-25 11:30:44
Subject: Prepared statement problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group