Re: JDBC parse error with preparedStatement!

From: Ramin Rad <ramin(at)flamenco-teacher(dot)com>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JDBC parse error with preparedStatement!
Date: 2004-01-12 01:33:08
Message-ID: 20040112013308.43020.qmail@web9804.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)ejurka(dot)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
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Keith C. Klopfer 2004-01-12 07:36:09 Weird ILIKE behavior
Previous Message Kris Jurka 2004-01-12 01:25:18 Re: JDBC parse error with preparedStatement!