• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

sql query stored in the xml, parsed and executed from java - throws malformed exception

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
dear all,

I store the sql queries like stored proc call query, other queries in an xml, i use this xml to parse an execute appropriate query. I have written dtd for it. assume xml element is like this





in dtd i have given stored-procedure (#PCDATA)

If i include the dtd file in xml and parse the xml the java code and execute the query jdbc throws Malformed SQL92 string at position: 34
If i remove the dtd and run the parser and execute the query it works!
I know that the #PCDATA will parse the text between the tag, how do i make it work?

Thanks for your helps
V
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My guess would be that different strings are being produced as a result of your parsing. If it were my problem I would be interested in seeing how those strings differ from each other.

Actually any time I got an error message saying my SQL string had a problem, my first idea would be to look at that string. I recommend that.
 
az ziz
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for you reply Mr. Clapham,
i had checked the query that is sent to the jdbc statement.
I use apache sax parser


the value string extracted comes differently. how does this happen?
I see that the query string has been lost, before or after in the query string. but what bothers me is that if i did not include the dtd file it works fine, no string is lost, no matter how much big or complex the query be.

is this post changing topic from jdbc to xml parsing?

V
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the DTD file correct?

I am moving this thread to our XML and Related Technologies forum. The issue we have here is not related to sql, but to parsing XML.

Regards, Jan
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have run into the common misconception about the characters() method.

It does NOT grab all of the characters inside the element reliably. If the text gets split across two buffer-load you get exactly what you are seeing. Including the DTD is changing the way the characters you are interested in fall at buffer boundaries.

Bill
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic