Transaction locks the database using SQL Express
- From: "Mikael Stalvik" <mikael@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 30 Jul 2006 03:18:30 -0700
Hello,
I have a strange problem in a application I'm working with.
I'm working with Delphi, but I think that the problem occurs for any
programming language. I'll try to explain it as language independent as
possible. I use ADO (Win32) with the most recent MDAC drivers.
My application consists of one ADO Connection, connected to a SQL
Express 2005 database (conn1). This connection is connected when the
application starts.
In the User Interface, there's two buttons. The first button starts a
secondary thread which does the following:
1) Creates a new ADO connection (conn2) to the same SQL Express database
2) Creates a ADODataSet
3) Starts a transaction against conn2
4) Adds 10000 records using the dataset created in 2) to table 'tableX'
5) Commits the transaction
The second button performs a simple 'SELECT * FROM tableX' and iterates
all the returned records. For this select query the first connection
(conn1) is used.
Now to the problem:
I click the first button that starts the thread (which starts the
transaction in conn2). Directly after that I click the second button
which will return all records using conn1.
The dataset used for the SELECT command will NOT be opened until the
thread is terminated and the transaction is either rollbacked or
committed. Therefore, the User Interface will be blocked until the
thread is completed, which is what I tried to avoid by using a
secondary thread.
Even worse, if there are many records stored in 'tableX', the SELECT
command may fail with a 'Command Timeout error'.
If I use a Access database and a JET driver with the exact same code it
will behave just as expected.
Does anyone have an idea what's may be wrong with my code/logic or can
it be a limitation of SQL Express?
Thanks in advance for any hints!
Mikael Stalvik
.
- Follow-Ups:
- Re: Transaction locks the database using SQL Express
- From: Mikael Stalvik
- Re: Transaction locks the database using SQL Express
- From: Mikael Stalvik
- Re: Transaction locks the database using SQL Express
- Prev by Date: Re: Closed Recordset from SQL Server 2000 when calling a SQL stored procedure from an ASP page
- Next by Date: Re: Transaction locks the database using SQL Express
- Previous by thread: Re: SSIS not supported on SQL 2005 Express
- Next by thread: Re: Transaction locks the database using SQL Express
- Index(es):
Relevant Pages
|