Re: JDBC, PrepareStatement and TimeStamp problem

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: JDBC, PrepareStatement and TimeStamp problem
Дата
Msg-id Pine.BSO.4.61.0601101614450.26551@leary.csoft.net
обсуждение исходный текст
Ответ на JDBC, PrepareStatement and TimeStamp problem  (Jeffrey Leegon <nogeel@acm.org>)
Список pgsql-jdbc

On Tue, 10 Jan 2006, Jeffrey Leegon wrote:

> String tableName = "\"AdultData\"";
> String tempSql = "SELECT [some stuff] FROM ? WHERE [some conditions]";
> query = conn.prepareStatement(tempSql);
> query.setString(1, tableName);
>
> java.sql.SQLException: ERROR: syntax error at or near "$1"
>     at

You cannot use placeholders for stuctural parts of your query, only
parameters.  The server cannot create a prepared plan if it doesn't even
know what table you are operating on.

Kris Jurka

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Jeffrey Leegon
Дата:
Сообщение: JDBC, PrepareStatement and TimeStamp problem
Следующее
От: Marc Herbert
Дата:
Сообщение: cannot dollar-quote $$?$$ in PreparedStatements