Prepared statement problem

From: Djordje Nikolic <djordje(at)abanka(dot)co(dot)yu>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Prepared statement problem
Date: 2007-04-25 11:30:44
Message-ID: 462F3BE4.7080503@abanka.co.yu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2007-04-25 12:29:38 Re: Prepared statement problem
Previous Message Heikki Linnakangas 2007-04-25 08:37:38 Re: idle in transaction problem