This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
Joined: Jan 31, 2010
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...
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: