I want to execute multiple sql commands in a single program. But one command is a "select" and another is a "insert". Next thing is that both commands uses different tables of same database. How can I do this task.... I tried it using batch but is not working. Below is my trial code..
Can anyone please tell me where I m committing mistake....? Suggestions are welcome...
Putting JDBC code in JSP pages is not reccommended. I would like to advise you not to do that.
Attempting to multi-thread JDBC inside a JSP page is even more daring.
Such complex logic does not belong in JSP.
On running queries in parallel:
I would first check if I really need to do that. If you have performance issues, please find out what is causing them, before designing a fix.
Performance issues have the tendency not to be caused by what you think they are caused by (what a sentence).
Your sql seems to be simple. Are they giving you performance issues?
If you need to run the queries in parallel, you will have to learn about multi-threading in java, and about creating thread-safe JDBC code.