Hi , I am using a JDBC connection and inserting an entry into a table. After that i am committing the connection and coming back. After i commit the connection if any error comes in further processing, the entry that i have inserted is getting deleted from the table. Is it possible that an entry to get deleted after i commit the connection? Pls help.
Also , is there any way to find out who is deleting the entry from the table? I mean by what reason the entry of a table is getting deleted.
My code is called from a GUI which is deployed under TOMCAT. Is the entry deletion is because of TOMCAT ?
One, you have setAutoCommit backwards. To start a transaction you should be calling setAutoCommit(false) not true.
True says "I am not in a transaction so automatically commit each query as I execute them"
False says "I am in a transaction so do NOT automatically commit until I tell you"
Two if you want to see who did what to a row... I think you need to provide more information about what database you are using because the answers will vary from vendor to vendor. But to point you in the general direction of something that would work I would say some sort of DELETE trigger would do it.
Three in your code snippet you do not explictly close your statement. You should always close all ResultSets and Statements along with Connections in the reverse order as you created them. Otherwise you may well be leaking resources. [ September 22, 2005: Message edited by: Maximilian Stocker ]