- Q ASEM is Asia Europe Meeting Summit. Recently where it's seventh summit was held?
- Q Find the mean and median for the following data: 12,3,18,7,4,9,7,19,20, 15,8,17,2. Are they equal?
- Q What is Queue in Scala Collection?
- Q What is Essbase Partitioning?
- Q When i try to use the java importer feature i get a pde error why is this?
- Q What are the family and order of African glass catfish ?
- Q What is the difference between an isolator and a circulator? Can a circulator be used as an isolator?
- Q The symbol of Sr stands for
- Q What is the difference between capitalism and communism? Are they really that different?
- Q Srisailam Temple is located in
- Q Where is the tomb of Khwaja Muinuddin Chisti?
Answers
When a connection is created, it is in auto-commit mode. This means that each individual SQL statement is treated as a transaction and will be automatically committed right after it is executed. The way to allow two or more statements to be grouped into a transaction is to disable auto-commit mode
Eg.
con.setAutoCommit(false);
Once auto-commit mode is disabled, no SQL statements will be committed until you call the method commit explicitly.
Eg.
con.setAutoCommit(false);
PreparedStatement updateSales = con.prepareStatement(
"UPDATE COFFEES SET SALES = ? WHERE COF_NAME LIKE ?");
updateSales.setInt(1, 50);
updateSales.setString(2, "Colombian");
updateSales.executeUpdate();
PreparedStatement updateTotal = con.prepareStatement("UPDATE COFFEES SET TOTAL = TOTAL + ? WHERE COF_NAME LIKE ?");
updateTotal.setInt(1, 50);
updateTotal.setString(2, "Colombian");
updateTotal.executeUpdate();
con.commit();
con.setAutoCommit(true); Your Comment
Eg.
con.setAutoCommit(false);
Once auto-commit mode is disabled, no SQL statements will be committed until you call the method commit explicitly.
Eg.
con.setAutoCommit(false);
PreparedStatement updateSales = con.prepareStatement(
"UPDATE COFFEES SET SALES = ? WHERE COF_NAME LIKE ?");
updateSales.setInt(1, 50);
updateSales.setString(2, "Colombian");
updateSales.executeUpdate();
PreparedStatement updateTotal = con.prepareStatement("UPDATE COFFEES SET TOTAL = TOTAL + ? WHERE COF_NAME LIKE ?");
updateTotal.setInt(1, 50);
updateTotal.setString(2, "Colombian");
updateTotal.executeUpdate();
con.commit();
con.setAutoCommit(true); Your Comment
- 0
- 0
- New Answer
- Contributors: *,
More Java Questions..
Can variables be used in Java without initialization?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
What is the difference between java bean and enterprise java bean?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
How does the java database connectivity (jdbc) work?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
What are the advantages of threads in java?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 0 )
- Tags: Java,
What Is Java Api For Xml-based Rpc (jax-rpc)?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
What is static synchronized method in JDBC API? Give an example?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
Should we override finalize method
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
What is object cloning in Java?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 0 )
- Tags: Java,
What is difference between notify() and notfiyAll()
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
Describe java's security model.
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
Is there is any error if you have multiple main methods in the same class?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
What is the name of the method used to schedule a thread for execution?
1) init();
2) start();
3) run();
4) resume();
5) sleep();
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
Can I import the same package/class twice? Will the JVM load the package twice at runtime?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 0 )
- Tags: Java,
What releases of Java technology are currently available? What do they contain?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 0 )
- Tags: Java,
What is asymmetric clustering in WebSphere?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
What is pass by value and pass by reference?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 0 )
- Tags: Java,
What are the actions that can occur when a thread enters blocked state
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
How do I launch the browser using WebDriver
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
What is the use of Void(0)?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
How does the native language C or C++ understand data types in JAVA
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,