Prepared statement problem - Mailing list pgsql-jdbc

From Djordje Nikolic
Subject Prepared statement problem
Date
Msg-id 462F3BE4.7080503@abanka.co.yu
Whole thread Raw
Responses Re: Prepared statement problem
List 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




pgsql-jdbc by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: idle in transaction problem
Next
From: Dave Cramer
Date:
Subject: Re: Prepared statement problem