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

From Kris Jurka
Subject Re: JDBC parse error with preparedStatement!
Date
Msg-id Pine.LNX.4.33.0401112023080.3834-100000@leary.csoft.net
Whole thread Raw
In response to JDBC parse error with preparedStatement!  (Ramin Rad <ramin@flamenco-teacher.com>)
Responses Re: JDBC parse error with preparedStatement!
List 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 by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: PreparedStatement parameters and mutable objects
Next
From: "Keith C. Klopfer"
Date:
Subject: Weird ILIKE behavior