Transaction Management in JDBCTransaction represents a single unit of work. The ACID properties describes the transaction management well. ACID stands for Atomicity, Consistency, isolation and durability. Atomicity means either all successful or none. Consistency ensures bringing the database from one consistent state to another consistent state. Isolation ensures that transaction is isolated from other transaction. Durability means once a transaction has been committed, it will remain so, even in the event of errors, power loss etc. Advantage of Transaction Mangaementfast performance It makes the performance fast because database is hit at the time of commit. In JDBC, Connection interface provides methods to manage transaction.
Simple example of transaction management in jdbc using StatementLet's see the simple example of transaction management using Statement. If you see the table emp400, you will see that 2 records has been added. Example of transaction management in jdbc using PreparedStatementLet's see the simple example of transaction management using PreparedStatement. It will ask to add more records until you press n. If you press n, transaction is committed. Next TopicBatch Processing in JDBC |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India