Subject | Re: [firebird-support] Deadlock error from firebird during midnight |
---|---|
Author | LtColRDSChauhan |
Post date | 2017-12-03T12:37:33Z |
On Sun, Dec 3, 2017 at 5:04 PM, DougC doug@... [firebird-support] <firebird-support@yahoogroups.com> wrote:Please, let us know what the cause ended up being and how you resolved the problem!Alright, I will explain the issue in detail.
1. I have a .NET application of mine deployed since about last 7 yrs with about 90 tables in the firebird database. Very routinely, as per customer’s requirement, I need to carry out changes to database structure [adding / renaming / removing – field(s) OR table(s)]. After doing such updates to my database structure I copy data to the new design database, through a .NET application.
2. Recently after about 7 yrs, I started to get exception “Error reading data from the connection” during transfer of data for a table which now had grown to about 13,26,000 records. For this table I was using FbDataAdapter to copy data in batches of 50,000 records.
3. I observed that every time the exception was raised after copying 12,50,000. So from the source, I deleted the already copied 12,50,000 records and resumed to copy the remaining 76,000. This too failed.
4. Later all my attempts as under failed:
(a) using FbDataReader in place of FbDataAdapter.
(b) changing connecting string elements like Connection Timeout, Connection lifetime, Pooling.
(c) Copying after backup-restore of both source and destination database.
(d) Changing machines.
5. So I wrote a stored procedure with inputs from Dimitry which copied records using execute Statement On External database. This stored procedure I executed through FbCommand's ExecuteNonQuery. This worked fine.
6. Now on Dimitry’s advice I changed the FbTransaction from:
FbTransaction tx = con.BeginTransaction();
To:
FbTransaction tx = con.BeginTransaction(
new FbTransactionOptions() {TransactionBehavior =
FbTransactionBehavior.Concurrency |
FbTransactionBehavior.NoWait});
And found that FbDataAdapter also started to work correct.
7. The option at Para 5 is much faster. In case you need more details / code I will please share.
Regards,Rajiv---- On Sat, 02 Dec 2017 23:08:49 -0500 LtColRDSChauhan rdsc1964@... [firebird-support] <firebird-support@yahoogroups. com> wrote ----Thanks a lot, Dimitry !This issue of mine, for which I had posted for help on the firebird-net-provider group, is now resolved.