parameter substitution problem in jdbc driver? (8.1)

Started by Dave E Martin XXIIIabout 20 years ago2 messagesgeneral
Jump to latest
#1Dave E Martin XXIII
postgresql-to.dave@dave.to

When a query of this form:

/* from xxx where yyy = ? */ select a,b,c,d from xxx where yyy = ?

is sent to the jdbc driver (as a prepared statement), it complains that
parameter 2 is not set. This is a query from hibernate3.1, with
hibernate's "generate comments in sql" option turned on.

I'm not really sure who is at fault here, or if this is one of those
unspecified things, but I would assume that parameter substitution
should not apply to comments?

Looking at the prepared statement in the debugger, it did indeed try to
do parameter substitution inside the comment.

Is the problem in the JDBC driver, in Hibernate, or in the JDBC spec?

#2Kris Jurka
books@ejurka.com
In reply to: Dave E Martin XXIII (#1)
Re: parameter substitution problem in jdbc driver? (8.1)

On Fri, 27 Jan 2006, Dave E Martin wrote:

When a query of this form:

/* from xxx where yyy = ? */ select a,b,c,d from xxx where yyy = ?

is sent to the jdbc driver (as a prepared statement), it complains that
parameter 2 is not set. This is a query from hibernate3.1, with hibernate's
"generate comments in sql" option turned on.

Is the problem in the JDBC driver, in Hibernate, or in the JDBC spec?

This is the JDBC driver's fault. There are a number of places it does not
correctly detect placeholders vs. comments/text, for example dollar
quoting is another one.

Kris Jurka