File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Executing a batch of SQL commands Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Executing a batch of SQL commands" Watch "Executing a batch of SQL commands" New topic

Executing a batch of SQL commands

Anusha Bhatnagar

Joined: May 24, 2011
Posts: 9

In my application,I'm actually need to collect a list of SQL commands(Normal update,delete as well as Calls to Stored Procedure) together by then execute the selected ones from the list and execute them to the Database and commit. I collect these statements after I execute each of them,see their effect and rollback immediately.Then the user can look at the commands required and select them and execute or rollback depending on whether they like the resultant effect or not. I'm actually storing the sql command Strings
together in a list.

So,I'm facing two problems in doing this.

1. It seems that executing a Stored Procedure is only through a CallableStatement.How can I achieve the SQL command for this to solve my purpose?

2. How can execute a batch of such statements together?

I agree. Here's the link:
subject: Executing a batch of SQL commands
jQuery in Action, 3rd edition