Subject Re: [Firebird-Java] Firebird with Coldfusion 10 and Jaybird 2.2.9 problem
Author Mark Rotteveel
On Tue, 3 Nov 2015 10:53:17 +0100, "'Damian Strykowski'
strykowski@... [Firebird-Java]" <Firebird-Java@yahoogroups.com>
wrote:
> I have problems with the new driver version above Jaybird-2.1.6JDK_1.6 i
> get
> the following error message
>
> GDS Exception. 335544652. multiple rows in singleton select
>
> when executing the following SQL
>
> DELETE FROM SOME_TABLE WHERE SOME_ID = 4146
>
> i installed the following:
>
> 1. JDK 1.8
> 2. Firebird 2.5.4.26856_0_x64
> 2. JDBC driver Jaybird-2.2.9-JDK_1.8
> 3. ColdFusion 10 Update 17
>
> Everything is working fine with Jaybird-2.1.6JDK_1.6 but not with any
> version above.

Jaybird 2.2 introduced support for getGeneratedKeys(). The problem is that
ColdFusion executes (or prepares) all statements using
Statement.RETURN_GENERATED_KEYS. This triggers the flow in Jaybird to
modify the query to be able to return generated keys (or actually: all
columns). Unfortunately Firebird has the limitation that
INSERT/UPDATE/DELETE ... RETURNING ... only works for statements that
modify at most one row. If a query modifies more than one row, then
Firebird will return the error 335544652 "multiple rows in singleton
select".

For now you could try to remove the antlr-runtime-3.4.jar from the
classpath to disable generated keys support, but I am not sure if that will
fix the problem as the DatabaseMetaData currently always reports
supportsGetGeneratedKeys=true even if the required antlr-runtime is not
available (but I would like to hear if it does). It is also possible that
ColdFusion (or your application) depends on antlr, in which case this isn't
even an option. Otherwise you will need to continue using 2.1.6 for now.

I will consider adding a compatibility property to disable support for
getGeneratedKeys for update/delete to reduce the likelihood of this error
occurring, however I am not sure if I will do that, nor if it will land in
2.2.10, or only in 3.0.

The DatabaseMetaData problem will be fixed in JDBC-412 for 2.2.10; it
might allow you to use 2.2.10 when you leave out antlr-runtime-3.4.jar. The
potential improvement to (partially) disable generated keys support is
JDBC-413.

Mark