Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 6105 invoked from network); 23 Mar 2006 03:51:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 23 Mar 2006 03:51:31 -0000 Received: (qmail 55295 invoked by uid 500); 23 Mar 2006 03:51:29 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 55278 invoked by uid 500); 23 Mar 2006 03:51:29 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 55266 invoked by uid 99); 23 Mar 2006 03:51:29 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Mar 2006 19:51:29 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of larry.meadors@gmail.com designates 66.249.82.206 as permitted sender) Received: from [66.249.82.206] (HELO xproxy.gmail.com) (66.249.82.206) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Mar 2006 19:51:28 -0800 Received: by xproxy.gmail.com with SMTP id s19so255303wxc for ; Wed, 22 Mar 2006 19:51:08 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:sender:to:subject:in-reply-to:mime-version:content-type:references; b=tSuASe6ifdXMLJAZli5mvN5SIIcxCUIrDywGjWA6mFLflyxHW2r4lhlSLouoQi7o6yVVdyXl8TV2bA+3tKDq8QgYnYe3Qfs9cYpwwvk05bAJKqx2rCvxFJb48Sl+NHTU5414vJWWlGQQ1NbAmUTTfGO3rSrxurMBuCCXwAFN8bk= Received: by 10.70.96.5 with SMTP id t5mr1970958wxb; Wed, 22 Mar 2006 19:51:07 -0800 (PST) Received: by 10.70.74.20 with HTTP; Wed, 22 Mar 2006 19:51:06 -0800 (PST) Message-ID: Date: Wed, 22 Mar 2006 20:51:06 -0700 From: "Larry Meadors" Reply-To: lmeadors@apache.org Sender: larry.meadors@gmail.com To: user-java@ibatis.apache.org Subject: Re: sql server 2k parameterized queries In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10312_12976553.1143085866975" References: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_10312_12976553.1143085866975 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Can you post the mapped statement? Larry On 3/22/06, Bob wrote: > > I'm trying to use ibatis with sql server 2k, and I'm having problems > with parameterized queries. I have many parameterized queries working > with mysql, and I'm really confused as to why this is causing a > problem. The query is set up very similarly to all the mysql ones > (except it is trying to put the results in a list of hashmaps rather > than of beans) > > I am recieving the following exception when trying to use the query. > > com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred while applying a parameter map. > --- Check the getPayoutOrgData-InlineParameterMap. > --- Check the statement (query failed). > --- Cause: java.sql.SQLException: Incorrect syntax near the keyword > 'GROUP'. > Caused by: java.sql.SQLException: Incorrect syntax near the keyword > 'GROUP'. > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryW= ithCallback > (GeneralStatement.java:185) > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryF= orList > (GeneralStatement.java:123) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList( > SqlMapExecutorDelegate.java:610) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList( > SqlMapExecutorDelegate.java:584) > at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList( > SqlMapSessionImpl.java:101) > at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList( > SqlMapClientImpl.java:78) > > SQL Profiler suggests that the following is being executed by Ibatis > create proc #jtds000002 @P0 nvarchar(4000) as SELECT WHERE @P0 > GROUP BY > > Running that query in Query Analyser indeed gives the same error that > there is an incorrect syntax near "GROUP". > However, if I run the query stripping out the proc and @P0 and > replacing it with the actual parameter, it works flawlessly. > > Does Ibatis support parameterized queries with SQL Server 2000? > Can anyone think of anything I might be doing wrong to get this error? > Would more information on any part of the problem be helpful? > > I would grately appreciate any help or suggestions - I am prepared to > consider anything! I've been really struggling with this and am > stumped at the moment. > > Thanks a lot, > > Bob Ball > ------=_Part_10312_12976553.1143085866975 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Can you post the mapped statement?

Larry


On 3/22/06, Bob <gnomeking@gmail.com> wrote:
I'm trying to use ibatis with sql server 2k, and I'm having problems
wit= h parameterized queries.  I have many parameterized queries worki= ng
with mysql, and I'm really confused as to why this is causing a
pr= oblem.  The query is set up very similarly to all the mysql ones
(except it is trying to put the results in a list of hashmaps ratherthan of beans)

I am recieving the following exception when trying t= o use the query.

com.ibatis.common.jdbc.exception.NestedSQLException :
--- The error occurred while applying a parameter map.
--- Check th= e getPayoutOrgData-InlineParameterMap.
--- Check the statement (query fa= iled).
--- Cause: java.sql.SQLException: Incorrect syntax near the keywo= rd 'GROUP'.
Caused by: java.sql.SQLException: Incorrect syntax near the keyword 'GR= OUP'.
        at com.ibatis.sqlm= ap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(Gener= alStatement.java:185)
        at= =20 com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryFor= List(GeneralStatement.java:123)
      &nbs= p; at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForLis= t(SqlMapExecutorDelegate.java:610)
        at com.ibatis.sqlmap.engine= .impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:584)<= br>        at com.ibatis.sqlmap.eng= ine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:101)
&nbs= p;       at=20 com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImp= l.java:78)

SQL Profiler suggests that the following is being execute= d by Ibatis
create proc #jtds000002 @P0 nvarchar(4000) as SELECT <bla= h> WHERE @P0
GROUP BY <blah>

Running that query in Query Analyser indee= d gives the same error that
there is an incorrect syntax near "GROU= P".
However, if I run the query stripping out the proc and @P0 and
replacing it with the actual parameter, it works flawlessly.

Doe= s Ibatis support parameterized queries with SQL Server 2000?
Can anyone = think of anything I might be doing wrong to get this error?
Would more = information on any part of the problem be helpful?

I would grately appreciate any help or suggestions - I am prepared = to
consider anything! I've been really struggling with this and am
st= umped at the moment.

Thanks a lot,

Bob Ball

------=_Part_10312_12976553.1143085866975--