What are batch updates. in jdbc

Answers were Sorted based on User's Feedback



What are batch updates. in jdbc..

Answer / gajendra

Batch updates is a facility given by the JDBC to the
application developers to submit a set of SQL update
statements as batch to the database.

st.addBatch("Update statement1");
st.addBatch("Update statement2");
st.addBatch("Update statement3");

int updated[]=st.executeBatch();// This methods throws
BatchUpdateException and SQLException

Is This Answer Correct ?    3 Yes 0 No

What are batch updates. in jdbc..

Answer / vijayakumar chinnasamy

Batch Update provide the functionality of executing a group
of sql statement at single timing.

Steps:

1.set autocommit as false for connection .
connectionObject.setAutoCommit(false);
2.create sql statement and add to statement object.
statementObj.addBatch("sql1");
statementObj.addBatch("sql2");
statementObj.addBatch("sql3");
3.execute the batch of statement using executeBatch().
statementObj.executebatch();
4. commit the connection.
connectionObj.commit();

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More Core Java Interview Questions

What are the types of literals?

0 Answers  


What are different types of access modifiers?

3 Answers  


How to do validation of the fields in any project ?

2 Answers  


Is there any tag in htm to upload and download files?

0 Answers  


Does every java program need a main?

0 Answers  






Is 0 a real number?

0 Answers  


how to use crystal reports in java

2 Answers  


What is method in research paper?

0 Answers  


Why stringbuilder is not thread safe in java?

0 Answers  


How GUI component handle its own events?

1 Answers  


What was java originally called?

0 Answers  


Explain differences between collection api and stream api?

0 Answers  


Categories