Loading
JDBC Batch Updates

Java Quick Notes

Refresh Your Java - Before Java Interview

We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

Go to SiteMap

Q)  JDBC Batch Updates ?


Ans)

JDBC batch update is a collectively called when a group of SQL statements are executed simultaneously to a database as a single unit.
 The batch is sent to the database in a single request using connection object. The advantage of batch is to reduce the network calls between the
 front end application and its database rather  than executing single SQL statement.  Please take a look at the example below.

  con = DriverManager.getConnection(url + db, user, pass);
  con.setAutoCommit(false);// Disables auto-commit.
  st = con.createStatement();
  st.addBatch("update person set cname='Smith' where id='1'");
  st.addBatch("update person set cname='Dave' where id='2'");
  st.addBatch("update person set cname='Chris' where id='3'");
  st.executeBatch();

  String sql = "select * from person";
  rs = st.executeQuery(sql);
  System.out.println("No Name");
  while (rs.next()) {
  System.out.print(rs.getString(1) + " \t");
  System.out.println(rs.getString(2));
  }
  rs.close();

 



Back to top

------------------------- We hope you got necessary Info On -----------------------------------------

JDBC Batch Updates


JDBC Batch Updates

-------------------------------------------------------------------------------------------------------



Face Book
Request for a Mock Interview/Training

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free