Re: JDBC parse error with preparedStatement!

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: JDBC parse error with preparedStatement!
Дата
Msg-id Pine.LNX.4.33.0401112023080.3834-100000@leary.csoft.net
обсуждение исходный текст
Ответ на JDBC parse error with preparedStatement!  (Ramin Rad <ramin@flamenco-teacher.com>)
Ответы Re: JDBC parse error with preparedStatement!
Список pgsql-jdbc

On Sun, 11 Jan 2004, Ramin Rad wrote:
> > > I am getting a very annoying parse error message on a simple delete
> > statement:
> > >
> > >   String sqlStmt = "DELETE FROM ft_member WHERE username = ?";
> > >   PreparedStatement stmt = connection.prepareStatement( sqlStmt );
> > >   stmt.setString( 1, "test");
> > >   stmt.executeUpdate( sqlStmt );
> > >
> > > Here is the error message:
> > >
> > > Exception in thread "main" java.sql.SQLException: ERROR:  parser: parse
> > error
> > > at end of input
> > >

Re-reading your original message made the problem apparent. You should
just do stmt.executeUpdate(), not pass in the sqlStat which is overriding
the prepared query.

Kris Jurka


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

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: PreparedStatement parameters and mutable objects
Следующее
От: "Keith C. Klopfer"
Дата:
Сообщение: Weird ILIKE behavior