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-11 23:30:20
Message-ID: 20040111233020.71635.qmail@web9805.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


Thanks for the suggestion. Here is the log:

LOG: query: set datestyle to 'ISO'; select version(), case when
pg_encoding_to_char(1) = 'SQL_ASCII' then 'UNKNOWN' else getdatabaseencoding()
end;
LOG: query: set client_encoding = 'UNICODE'; show autocommit
LOG: query: DELETE FROM ft_member WHERE username = ?
ERROR: parser: parse error at end of input
LOG: pq_recvbuf: unexpected EOF on client connection

I don't quite know how the driver works, but shouldn't the '?' be replaced with
the variable by stmt.setString( 1, "test") before it is sent to the database?
Looks like a problem with JDBC driver.

Your help is extremely appreciated.

-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
> >
>
> I can't see anything that's going wrong here either. The best way to
> debug this problem is to enable statement loggin on the server so we can
> see the exact query the server tries to run. To do this enable
> log_statement in postgresql.conf and restart the server.
>
> Kris Jurka
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Paul Thomas 2004-01-11 23:33:03 Re: jdbc pooling question
Previous Message Kris Jurka 2004-01-11 23:04:36 Re: Multi-dimensional array support