Re: JDBC parse error with preparedStatement!

Поиск
Список
Период
Сортировка
От Ramin Rad
Тема Re: JDBC parse error with preparedStatement!
Дата
Msg-id 20040112013308.43020.qmail@web9804.mail.yahoo.com
обсуждение исходный текст
Ответ на Re: JDBC parse error with preparedStatement!  (Kris Jurka <books@ejurka.com>)
Список pgsql-jdbc
You are right! I just discovered that a few minutes ago myself by looking at
the Driver code and seeing this:

public int executeUpdate(String p_sql) throws SQLException
{
      String l_sql = replaceProcessing(p_sql);
      m_sqlFragments = new String[] {l_sql};
--->  m_binds = new Object[0];

After staring at it a few minutes and scratching my head thinking why this
method is doing "m_binds = new", I realized that I was calling the wrong
method!

Thank you SO SO SO much for your help.

-ramin


--- Kris Jurka <books@ejurka.com> wrote:
>
>
> 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 по дате отправления:

Предыдущее
От: Ramin Rad
Дата:
Сообщение: Re: JDBC parse error with preparedStatement!
Следующее
От: Ramin Rad
Дата:
Сообщение: Re: JDBC parse error with preparedStatement!