How transactions are performed using JDBC ?

Answer Posted / ketan

transaction means two or more queries are perform
simultaneously.

1. Hence befor first query put up setAutoCommit(false);

2. now at the end of several queries performed. if you know
how much rows will affect this transaction then you can
compare it with current transaction rows.

3. if both equals then commit() and setAutoCommit to true in
else rollback() and setAutoCommit(true).

4. as well as in catch statement put rollback() and
setAutoCommit(true);

5. and in finally setAutoCommit(true).

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different types of statements? How we can you use preparedstatement.

505


What is a rollback in jdbc?

516


What are the main components of JDBC ?

568


Explain how data flows from view to db and reverse

1624


How to get the Database server details in java program?

567






Does JDBC support stored procedures?

551


How can we disable a constraint ?

557


What is jdbc databasemetadata interface?

541


Explain the difference between inner and outer join ?

509


What are the different types of interfaces in the api component?

517


How do I find jdbc version?

527


Name the new features added in jdbc 4.0.

540


what is the meaning of following code snippets Class c=class.forName(driverClassName); Driver d=(driver)c.newInstance();

4318


Once I have the Java 2 SDK, Standard Edition, from Sun, what else do I need to connect to a database?

534


What are the factors that the jdbc driver performance depends upon?

516