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 is meant by object oriented programming – oop?

0 Answers  


What is meant by 'bit masking' in java?

0 Answers   DELL,


what is the output ? Math.floor(-2.1) a)2 b)-2 c)-3.0 d)0

4 Answers   Accenture,


What is the purpose of return statement?

0 Answers  


Explain reverse a linked list iterative solution in java?

0 Answers  






How many types of JVM's (OR) Name of the JVM's which are used in Tomcat & Weblogic servers ?

1 Answers   TCS,


Explain the difference between extends thread vs implements runnable in java?

0 Answers  


Describe 2 different ways to concatenate two strings.

0 Answers   TCS,


How many ways can an argument be passed to a subroutine?

3 Answers   Technological University of the Philippines,


make a method which any number and any type of argument and print sum of that arguments.....

0 Answers  


What is computer compiler?

0 Answers  


i need to know the website that i can compile and run a java code in online.(while system doesn't contain any jdk and jre)

0 Answers  


Categories