Re: JDBC parse error with preparedStatement! - Mailing list pgsql-jdbc

From Ramin Rad
Subject Re: JDBC parse error with preparedStatement!
Date
Msg-id 20040112013308.43020.qmail@web9804.mail.yahoo.com
Whole thread Raw
In response to Re: JDBC parse error with preparedStatement!  (Kris Jurka <books@ejurka.com>)
List 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 by date:

Previous
From: Ramin Rad
Date:
Subject: Re: JDBC parse error with preparedStatement!
Next
From: Ramin Rad
Date:
Subject: Re: JDBC parse error with preparedStatement!