dbTalk Databases Forums  

odbc timeout when using a transaction

comp.databases.ms-access comp.databases.ms-access


Discuss odbc timeout when using a transaction in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Roger
 
Posts: n/a

Default odbc timeout when using a transaction - 02-24-2011 , 03:02 PM






I've got a linked sql server table (tblFoo) in access2007
and I'm trying to process a transaction, see below
but it fails setting rs2 with
ODBC--call failed. ,DAO.Database ,3146
- [Microsoft][ODBC SQL Server Driver]Timeout
expired ,ODBC.Database ,0

can I not open two recordsets for the same record within a
transaction ?
what are the alternatives ?
using one recordset for both is not an option


Set wrk = DBEngine.Workspaces(0)
wrk.BeginTrans
Set db = wrk.Databases(0)
set rs = db.openRecordset("SELECT id FROM tblFoo WHERE id = 1")
...

set rs2 = db.openRecordset("SELECT * FROM tblFoo WHERE id = 1")
....

wrk.commitTrans

Reply With Quote
  #2  
Old   
stefan
 
Posts: n/a

Default Re: odbc timeout when using a transaction - 02-24-2011 , 04:30 PM






Hi Roger,
the error 3146 "ODBC call failed" means, there occurs an error at your BE-ODBC-database.
This error occurs often if you have sql-errors.

In your case, I think, it is a locking problem.
With your first recordset you lock the record and the second recordset cannot use the locked record! This lasts until timeout which causes the error.
Probably you only want to read the record at least in your recordset rs.
I think it depends on your BE-DBMS, how you can ensure, that the reading doesn't raise a lock. Then the second access on the same record must be possible.
grts
Stefan

Reply With Quote
  #3  
Old   
Travis Crow
 
Posts: n/a

Default Re: odbc timeout when using a transaction - 03-09-2011 , 05:38 AM



On Thu, 24 Feb 2011 13:02:21 -0800, Roger wrote:

Quote:
I've got a linked sql server table (tblFoo) in access2007 and I'm trying
to process a transaction, see below but it fails setting rs2 with
ODBC--call failed. ,DAO.Database ,3146
- [Microsoft][ODBC SQL Server Driver]Timeout
expired ,ODBC.Database ,0

can I not open two recordsets for the same record within a transaction ?
what are the alternatives ?
using one recordset for both is not an option
The problem with transactions is if you update anything, what you update
is locked until you commit or rollback, attempting to open the second
recordset on the same table may encounter that lock, it will wait for
that lock to be cleared but the code that is waiting is the same code
that locked it hence the timeout.

You may get better results re-writing your updates as a stored procedure
or try opening the second recordset before you update anything in the
first.

--
Travis Crow

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.