Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

in-operator leads to syntax error

5 views
Skip to first unread message

Mike Pieper

unread,
Feb 26, 2010, 4:24:34 AM2/26/10
to
Hi all,

I use in an IN-operator with 13 parameters in a select statement like this:
SELECT COUNT("COL1") FROM "TABLE1" WHERE "COL2" = ? AND "COL1" IN (?, ?, ?, ?
, ?, ?, ?, ?, ?, ?, ?, ?, ?)

on execution I get an error that there is a syntax error near the ','.

When I look with the SQL-profiler I see that the statement is translated
into the following (to get the result data types?):
sqljdbc_1.2.2828
SET FMTONLY ON SELECT "LISTENER_NAME_L", "EVENT_NAME_L", ,, ,, ,, ,, ,, ,, ,,
,, ,, ,, ,, , FROM "EVENT_LISTENER" SET FMTONLY OFF

or sqljdbc_2.0.1803
sp_executesql N'SET FMTONLY ON SELECT "LISTENER_NAME_L", "EVENT_NAME_L", ,, ,
, ,, ,, ,, ,, ,, ,, ,, ,, ,, , FROM "EVENT_LISTENER" WHERE 1 = 2'

which is obviously the reason for the syntax error.

But what can I doo to prevent this error?
The given select statement is simple SQL or?

Mike

url:http://www.ureader.com/gp/1148-1.aspx

Mike Pieper

unread,
Mar 3, 2010, 3:34:29 AM3/3/10
to
Found the solution!

The error appears only in conjunction with Apache commons-dbutils in version
1.3.
Solution is to set pmdKnownBroken to true. Like here:
QueryRunner x = new QueryRunner(dataSource, true);

Mike

url:http://www.ureader.com/msg/1148508.aspx

0 new messages