Transaction in dotNET and SqlServer
-
Hi there . During transaction is began , I inserted new data in table , until I don't call commit() or rollback() functions , another processes can not access to this table. I mean, if i try to add a new data in a table with transaction and before closing transaction(commit or rollback) another process can't read that table; then a exception will occurred. what is the problem?
DMASTER
-
Hi there . During transaction is began , I inserted new data in table , until I don't call commit() or rollback() functions , another processes can not access to this table. I mean, if i try to add a new data in a table with transaction and before closing transaction(commit or rollback) another process can't read that table; then a exception will occurred. what is the problem?
DMASTER
Developer611 wrote:
what is the problem?
There is no problem. A transaction shouldn't last long enough for there to be a problem. I'm guessing the other process times out waiting for the table to become available. And while it is in use in a transaction you have made it unavailable. The solution is to make your transactions shorter.
Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website
-
Developer611 wrote:
what is the problem?
There is no problem. A transaction shouldn't last long enough for there to be a problem. I'm guessing the other process times out waiting for the table to become available. And while it is in use in a transaction you have made it unavailable. The solution is to make your transactions shorter.
Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website
Thanks dear Colin . But how can I do this in short time . Did you have any solutions ?
DMASTER
-
Thanks dear Colin . But how can I do this in short time . Did you have any solutions ?
DMASTER
Developer611 wrote:
But how can I do this in short time . Did you have any solutions ?
What the heck are you actually doing? A transaction should start, the query(ies) run and the transaction committed or rolledback. What else are you doing in there that make it take so long?! If you start a transaction perform some queries, wait for user input, do some more queries then finally end the transaction then you have some serious redesigning to do.
Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website
-
Developer611 wrote:
But how can I do this in short time . Did you have any solutions ?
What the heck are you actually doing? A transaction should start, the query(ies) run and the transaction committed or rolledback. What else are you doing in there that make it take so long?! If you start a transaction perform some queries, wait for user input, do some more queries then finally end the transaction then you have some serious redesigning to do.
Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website
I have 5 or more queries that run in same time and one of queries take along time to done. I have to do all of this queries in a transaction. I have no way to do this in separate transactions. I think transactions work with temporary tables that mean changes will apply to original tables after commit. This means that we can use original tables while a transaction is running!?!:confused:
-
I have 5 or more queries that run in same time and one of queries take along time to done. I have to do all of this queries in a transaction. I have no way to do this in separate transactions. I think transactions work with temporary tables that mean changes will apply to original tables after commit. This means that we can use original tables while a transaction is running!?!:confused:
SalarSoft wrote:
I think transactions work with temporary tables that mean changes will apply to original tables after commit. This means that we can use original tables while a transaction is running!?!
No. If you in a transaction and you alter a table you are altering that actual table. No temporary tables are involved unless you explicitly involve them. Changes are made as you make them. If you roll back the changes are reversed.
SalarSoft wrote:
I have 5 or more queries that run in same time and one of queries take along time to done.
If you are using SQL Server 2005 you may like to look into Snapshot transactions. That might help you.
Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website