• 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

I do not know in which part of SAX Class

 
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying use SAX (java class) and an XML Doc to write xml data to database, well I do not know in which part of SAX Class, use the database conn, stm and execute query, statements??? can you help?

Also is it required use, ArrayList or Array or a collection?
 
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
There aren't any rules which say you always have to put the JDBC code in a particular part of your code. That's not how programming works. It's up to you to write the program and put the code in the correct places. (Where "correct" means "whatever works for your requirements".)

And likewise, no, you aren't required to use an ArrayList or any other collection in any code you write.

If you have a specific question, you should ask that specific question here. It seems like you don't know where to go with this SAX program you want to write. So how about if you produce some code, then explain your requirements and ask what to do with that code?
 
Leonidas Savvides
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For the particular sax refered I wrote code that prints correctly in output the query statement, but when I tried actual query , in another try this does not written in local db...

 
Paul Clapham
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

Leonidas Savvides wrote:For the particular sax refered I wrote code that prints correctly in output the query statement, but when I tried actual query , in another try this does not written in local db...



I see. Then what you should do is to write a small piece of code which does nothing but update a record in a database. Once you have that code working, put a copy of it in your SAX program and adapt it to use the data from SAX. Trying to use two hundred lines of code to debug a database interaction, when most of them have nothing to do with the database, is doing things the hard way.

And here's a hint: your code has a catch-clause which looks like this:

If the code above that throws an exception, then you won't know that. Because the catch clause does nothing. This is not a good way to debug your code. At least print the exceptions so you know when they happen and what went wrong. Like this:
 
Watchya got in that poodle gun? Anything for me? Or this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic