SQL Parse Error due to malformed XML after SELECT?

37 views
Skip to first unread message

Matt Gilg

unread,
Apr 6, 2011, 6:42:02 PM4/6/11
to M/DB Community Forum
I get the following error when executing this select statement against
M/DB. (Works fine with SimpleDB)

SELECT * from MyDomain WHERE group = '5.5.5' AND id='test1800'

Packet Processing Error:Unable to unmarshall response (ParseError at
[row,col]:[1,1]
Message: Content is not allowed in prolog.):
Response^MDB(.req3,.req4)res,req,extra,global,oversize,req3,req4
150373850,executeSelect+122^MDB,%GTM-E-UNDEF, Undefined local
variable: term(6)Web functions contain two arguments

HOWEVER - what is strange to me, is that if I strip the AND condition
out, it works.

SELECT * from MyDomain WHERE group = '5.5.5'
and
SELECT * from MyDomain WHERE id='test1800'
both work fine, and return my expected results.

Here is more complete output:
-----------------------------------------------------------------------------------------------------------------------------------------
INFO: Sending Request: com.amazonaws.DefaultRequest@facf0b
Apr 6, 2011 10:30:59 PM org.apache.commons.httpclient.HttpMethodBase
getResponseBody
WARNING: Going to buffer response body of large or unknown size. Using
getResponseBodyAsStream instead is recommended.
Apr 6, 2011 10:30:59 PM com.amazonaws.http.HttpClient handleResponse
SEVERE: Unable to unmarshall response (ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog.):
Response^MDB(.req3,.req4)res,req,extra,global,oversize,req3,req4
150373850,executeSelect+122^MDB,%GTM-E-UNDEF, Undefined local
variable: term(6)Web functions contain two arguments

javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog.
at
com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:
591)
at
com.sun.xml.internal.stream.XMLEventReaderImpl.peek(XMLEventReaderImpl.java:
273)
at
com.amazonaws.transform.StaxUnmarshallerContext.nextEvent(StaxUnmarshallerContext.java:
166)
at
com.amazonaws.services.simpledb.model.transform.SelectResultStaxUnmarshaller.unmarshall(SelectResultStaxUnmarshaller.java:
46)
at
com.amazonaws.services.simpledb.model.transform.SelectResultStaxUnmarshaller.unmarshall(SelectResultStaxUnmarshaller.java:
33)
at
com.amazonaws.http.StaxResponseHandler.handle(StaxResponseHandler.java:
100)
at
com.amazonaws.http.StaxResponseHandler.handle(StaxResponseHandler.java:
39)
at
com.amazonaws.http.HttpClient.handleResponse(HttpClient.java:521)
at com.amazonaws.http.HttpClient.execute(HttpClient.java:268)
at com.amazonaws.http.HttpClient.execute(HttpClient.java:160)
at
com.amazonaws.services.simpledb.AmazonSimpleDBClient.invoke(AmazonSimpleDBClient.java:
758)
at
com.amazonaws.services.simpledb.AmazonSimpleDBClient.select(AmazonSimpleDBClient.java:
216)
at Router.PacketHandler.routePacket(PacketHandler.java:109)
at Router.PacketHandler.handlePacket(PacketHandler.java:172)
at Router.PacketHandler.run(PacketHandler.java:197)
Packet Processing Error:Unable to unmarshall response (ParseError at
[row,col]:[1,1]
Message: Content is not allowed in prolog.):
Response^MDB(.req3,.req4)res,req,extra,global,oversize,req3,req4
150373850,executeSelect+122^MDB,%GTM-E-UNDEF, Undefined local
variable: term(6)Web functions contain two arguments
--------------------------------------------------------------------------

The "Content is not allowed in prolog" message seems to indicate some
slight "malformation" of the XML when multiple results are returned?

Has anybody else had success executing simple queries with MDB?

Thanks!
-Matt

Matt Gilg

unread,
Apr 6, 2011, 6:55:37 PM4/6/11
to M/DB Community Forum
Captured the following with tcpdump and analyzed with wireshark:

POST:
Action=Select&SignatureMethod=HmacSHA256&AWSAccessKeyId=IISOFJIEUSNXMCNAQSSD&SignatureVersion=2&Version=2009-04-15&Signature=
%2Bjd2%2FYvIxs0LLtGCqceBkHwRKFKV1rNZXOCeaPFA5XA
%3D&Timestamp=2011-04-06T22%3A48%3A11.299Z&SelectExpression=SELECT%20*
%20from%20MyDomain%20WHERE%20group%20%3D%20%275.5.5%27%20AND%20id%3D
%27test1800%27

The error returned is:

Error calling web function
mgwsiResponse^MDB(.req3,.req4)res,req,extra,global,oversize,req3,req4

Matt Gilg

unread,
Apr 8, 2011, 2:13:17 PM4/8/11
to M/DB Community Forum
Changing my select statement to use lowercase SQL syntax fixed the
problem. (specifically the 'AND' condition, in my case)

M/DB should probably force all the queries to lowercase before it
processes them?

-Matt

Rob Tweed

unread,
Apr 8, 2011, 2:16:04 PM4/8/11
to mdb-commu...@googlegroups.com
Ah good find!  Thats a nice easy thing for me to fix, Matt

Sorry I've been rather snowed under with fee-paying work recently which tends to take priority! :-)

I'll try to get an update done.  Also I'll email you privately soon as I think I'll set up an M/DB account for you on a server of mine so we can run some tests that I can trace within M/DB

Many thanks for your patience and your help!

Cheers

Rob


--
You received this message because you are subscribed to the Google Groups "M/DB Community Forum" group.
To post to this group, send an email to mdb-commu...@googlegroups.com.
To unsubscribe from this group, send email to mdb-community-f...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mdb-community-forum?hl=en-GB.




--
Rob Tweed
Director, M/Gateway Developments Ltd
http://www.mgateway.com
------------------
iWD: build iPhone Apps faster :
http://www.mgateway.com/iwd.html

rtweed

unread,
Apr 22, 2011, 4:04:21 AM4/22/11
to M/DB Community Forum
Build 39 of M/DB fixes this problem and has been posted to the Github
repository. See separate posting on how to upgrade existing M/DB
systems.

Rob

On Apr 8, 7:16 pm, Rob Tweed <rob.tw...@gmail.com> wrote:
> Ah good find!  Thats a nice easy thing for me to fix, Matt
>
> Sorry I've been rather snowed under with fee-paying work recently which
> tends to take priority! :-)
>
> I'll try to get an update done.  Also I'll email you privately soon as I
> think I'll set up an M/DB account for you on a server of mine so we can run
> some tests that I can trace within M/DB
>
> Many thanks for your patience and your help!
>
> Cheers
>
> Rob
>
> On 8 April 2011 19:13, Matt Gilg <gilg...@gmail.com> wrote:
>
>
>
>
>
> > Changing my select statement to use lowercase SQL syntax fixed the
> > problem. (specifically the 'AND' condition, in my case)
>
> > M/DB should probably force all the queries to lowercase before it
> > processes them?
>
> > -Matt
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "M/DB Community Forum" group.
> > To post to this group, send an email to
> > mdb-commu...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > mdb-community-f...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/mdb-community-forum?hl=en-GB.
>
> --
> Rob Tweed
> Director, M/Gateway Developments Ltdhttp://www.mgateway.com
Reply all
Reply to author
Forward
0 new messages