I have a read query that I execute within a transaction so that I can specify the isolation level. Once the query is complete, what should I do?
Commit the transaction
Rollback the transaction
Do nothing (which will cause the transaction to be rolled back at the end of the using block)
What are the implications of doing each?
usin...
I have an application that has many different types of objects that each persist themselves back to the db. This has worked fine so far without transactions and I'm not looking to go hog wild adding them. But there is an occasional need to start a transaction before a whole collection of the objects start updating to ensure that the data...
I´m using Transaction Binding=Explicit Unbind in the connection string as recommended here since I´m also using TransactionScope with timeout. The problem is that the connections does not seem to close after being disposed and eventually there are no more connections available in the connection pool. I got the same result when I modified...
I am using the following generic code to save entities.
using (ITransaction tx = session.BeginTransaction())
{
try
{
entity.DateModified = DateTime.Now;
session.SaveOrUpdate(entity);
session.Flush();
tx.Commit();
return entity;
}
catch (Exception)
{
tx.Rollback();
thro...
I will explain problem with an example:
There is two table in my database, named entry, tags
There is a column named ID_ENTRY in both table. When I add a record to table, entry, I have to take the ID_ENTRY of last added record and add it to table, tags. How can I do it?
...
Hi
I am new to asp.net. I am working on an application that is doing system transactions. At some point in code an exception is raised and the code bombs out. It bombs out when clicking on a particular row record in a grid list. However after the user sees the exception...they go back and try to click some other record..which should ...
Hi All,
I am new to mysqli, and trying to confirm that if I so something like the below, the errno will be set to the last error, if any, and not the error of the last query.
Is this a decent practice or should I be checking for the error in between every query?
Thanks!
$mysqli->autocommit(FALSE);
$mysqli->query("INSERT INTO ........
I am using Zend_Db to insert some data inside a transaction. My function starts a transaction and then calls another method that also attempts to start a transaction and of course fails(I am using MySQL5). So, the question is - how do I detect that transaction has already been started?
Here is a sample bit of code:
try {
...
If there a way to protect against concurrent modifications of the same data base entry by two or more users?
It would be acceptable to show an error message to the user performing the second commit/save operation, but data should not be silently overwritten.
I think locking the entry is not an option, as a user might use the "Back" but...
I am trying to set up a simple transaction for my Linq-to-Sql actions against my Sql 2000 database. Using TransactionScope it looks like this:
using (TransactionScope transaction = new TransactionScope())
{
try
{
Store.DBDataContext dc = new Store.DBDataContext();
Store.Product product = GetProduct("foo");
dc...
I've read the EJB3 spec and the latest O'Reilly and Manning books and yet I can't see defined anywhere how transactions are propagated over multiple session beans.
For example, if I call a method marked as "NEVER" on bean A and bean A calls a method marked as REQUIRESNEW on bean B, what happens?
In practice, using JBoss, we've observed...
I'm trying to perform transaction-like behavior with MonetDB and its JDBC driver.
I tried first to set autocommit to false for the connection, I then get the following error on commit :
java.lang.IndexOutOfBoundsException
at java.nio.StringCharBuffer.subSequence(StringCharBuffer.java:92)
at nl.cwi.monetdb.mcl.parser.StartOfHead...
Almost every new Java-web-project is using a modern MVC-framework such as Struts or Spring MVC for the web tier, Spring for the "Service"/business-logic-layer and an ORM mapper such as Hibernate for persistence. What is the equivalent in .NET?
I guess ASP.NET is used for the web tier and ADO.NET for persistence but what is the equivale...
We have a Hibernate/Spring application that have the following Spring beans:
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" />
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" />
When wiring the application together we get...
Here is the current architecture of my transaction scope source code. The third insert throws an .NET exception (Not a SQL Exception) and it is not rolling back the two previous insert statements. What I am doing wrong?
EDIT: I removed the try/catch from insert2 and insert3. I also removed the exception handling utility from the ins...
I have a problem where I want to read an object from the database using Hibernate, change a value, and save the object. If changing the value takes some time, what's the best way to ensure the underlying object in the database has not changed? I am doing this in one transaction (and one session).
The code looks something like:
// Load...
I'm trying to use System.Transaction.TransactionScope to create a transaction to call a few stored procedures but it doesn't seem to clean up after itself. Once the transaction is finished (commited or not and the transaction scope object is disposed) subsequent connections to the database open up with the read commit level of serializab...
I'm asking myself if it is possible to check if in ADO.NET the current transaction can be rolled back.
The msdn suggests the following implementation:
private static void ExecuteSqlTransaction(string connectionString)
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
...
I have a Spring web application which is configured to use JDK proxying for AOP. The AOP annotations (such as @Transactional) are declared on the interfaces, rather than the implementation classes.
The application itself works fine, but when I run the unit tests, it seems to be attempting to use CGLIB for the AOP functionality (instead ...
Trying to use ActiveRecord::Base.transaction I figured that rollback doesn't work by default using Rails 1.2.6 and mysql 5.0. Playing with it a little bit more I found out that autocommit is not set to 0 in mysql connection.
Questions:
1) how do I disable autocommit in rails for all connections
2) will it have some negative impact on...