Transaction management in JDBC so to write some fines young let me open the read + file menu you can take normal text file otherwise normal text file the normal text file I will read the point some points but the points you discussed no transaction management in JDBC right that's it tell me our Gautama transaction the transaction nothing but the set of operation can be set off for operations is called transaction right so here suppose if you take the movie ticket to select the movie to select the theater to select the seeds to do the payment option this all operations come under one transaction right is all arranged to comes under one transaction general yeah tell me how many is the transactions we have generally we have the two types of transaction one is the local transaction the second one is the global transaction right good guys if you won't take the just pain on pepper I try to note down all the points. 


I will show all the points again transaction win has been near will discuss three examples regarding transaction management I will show the material also regarding the transaction management this is your main material transaction management in JDBC set of operations is called a transaction suppose if you take the movie ticket booking to select the movie to verify the seeds work result in the seeds payment option issue the decades this all operations comes down to one transaction right is all operation comes under one transaction total ami tips or transactions we have two types of transactions one is a local transaction the second one is the global transaction right that's I did tell me what do you mean local transaction so here you are transferring money from one account to another account say one transfer the amount from what I call to another account both accounts are present in the same bank that is called a local transaction. 


Whatever global transaction transferring money from one account to another account that accounts are present in two different banks that is called global transaction okay so one account on the record both accounts are present in the same bank means transaction different banks means global transaction see here in the local transaction we can work with the only same tank right same bank means it supports homemade database here only one database it means it is a database dependent right so by using JDBC we can do only local transaction because JDBC is the database-independent right so by using JDBC we can do all ut transactions here local transaction but not a global transaction so if you want global transaction so JDBC for the local transaction if you want a global transaction you have to go with the hibernate framework it is a war apt or object-relational mapping probe right that's it so finally we decided by using JDBC we can do Woolwich transactions here local transaction right that's it. 


So local transact means the operates are performed only on a single database that's a tab see here so the main principle of transaction what is the main principle of transaction we have to do everything for the main principle here they do everything principle is do-nothing rich do everything or do nothing see the main principle of the transaction is do everything or do nothing right good so do everything means what is the option you how to do commit operation do nothing means we have to which operation here rollback operation or not so this is the way how the transaction is working see here with drive money from ATM so we have to do everything or do nothing right that is called one transaction sorry do everything or do nothing see here so the main principle of the transaction is to do everything is do nothing principle that's it but here to work with the commitment rollback operations in JDBC application. 


The database auto committees by default to actually in database side auto committees by default true means whenever the query is executed database is permanently updated right if the database is permanently updated means then commit and rollback will work are not commit and rollback Aloha cannot know right that is the reason if you want to apply the commit and rollback operations, first of all, we have to and Auto committee's false actually so we have to set the connection dot set auto-commit them to set auto committees we have to make it false because database auto committees by default which mode here true model once you set the auto committees false then only you can work with the commit under all that cooperation is right to wait for the point is clearer that's always and repeating once again you can check it out so we are doing transaction management in JDBC what do you made transaction setup for operations is called a transaction. 


So just like move indicate booking withdraw money from ATM this is called transaction ho meetings are transactions we have two types of transactions for the two types one is a local transaction the second one is the global transaction so transferring money from one account to another account both accounts are present in the same band there is a local transaction your JDBC supports for local transaction whatever global transaction transferring money from one account to another account these two accounts are present in two different banks that is called global transaction so high one it supports global transaction right that's it so what is the transaction main principle either do everything or do nothing principal do everything is committed do nothing miss rollback so but to apply the commit and rollback in date of Java's JDBC side database auto communities by default true actually database auto committees by default true means whenever the query is executed database is permanently updated. 


The reason to achieve this requirement is, first of all, we have to set the auto committees false once you set the auto committees false until unless when you do the commit operation then only the operations will be permanently abrade in the database or not the son we are permanently updated in the database which is called transactional so as you know transaction mainly work done as it properties this is you can check the middle ones I prepared this material for you guys at the end of this video I will show all the material slowly you can pause the video and you can if you want you can take this material and so the main page flow transaction is do everything up to do nothing principle you can go in the commit and roll back operation we have to set the auto committees in Auto Committee is the false form it is a transaction.

Post a Comment

Please do not enter ant spam link in the comment box

أحدث أقدم