From: David R. <fir...@li...> - 2005-07-12 15:51:18
|
Thank you for your response. However, this will not work in my=20 situation of multiple connections to a web service. While one user has=20 his transaction open, the other user is unable to read uncommitted data=20 or commit their own data. (I do not always want to commit the transactio= n.) This works when reading uncommitted data from another process. CAR...@te... wrote: >Hello: > =20 > >You should commit the transaction ( the default IsolationLevel is >ReadCommitted ): > >transaction1.Commit(); > >-- >Best regards > >Carlos Guzm=E1n =E1lvarez >Vigo-Spain > > > >> Hi, My application hangs when I open a second connection within the=20 >> same process, if a transaction is open in the first connection. In=20 >> my situation, this happens when there are simultaneous connections to=20 >> a web service, but the first connection holds its transaction open.=20 >> I've simplified the scenario and get my application to hang with this=20 >> code: FbConnection connection1 =3D new=20 >> FbConnection(connectionString); connection1.Open();=20 >> FbTransaction transaction1 =3D=20 >> connection1.BeginTransaction(); FbCommand command1 =3D new=20 >> FbCommand("insert into X (Y) values ('Z')", connection1,=20 >> transaction1); command1.ExecuteNonQuery(); =20 >> FbConnection connection2 =3D new FbConnection(connectionString);=20 >> connection2.Open(); FbCommand command2 =3D new=20 >> FbCommand("select Y from X", connection2); FbDataAdapter=20 >> dataAdapter2 =3D new FbDataAdapter(command2); DataSet=20 >> dataSet2 =3D new DataSet(); // The next line will hang...=20 >> dataAdapter2.Fill(dataSet2); While the process is hung, I=20 >> can still access and update the table using a different application,=20 >> or a separate instance of the same application. Additionally, it=20 >> does not hang if I use command2.ExecuteReader() instead. This leads=20 >> me to believe that it is not a record locking issue. Note also that=20 >> both the insert and select queries above access the same table, but=20 >> if I try it using different tables, the issue does not occur. Does=20 >> anyone know what I'm doing wrong? Thanks in advance, Dave=20 > > > =20 > |