pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas <maps.on@gmx.net>
To: pgsql-odbc@postgresql.org
Subject: concurrency with adodb & ms-access
Date: Sun, 26 Sep 2004 01:41:43 +0200
Message-ID: <41560237.3010205@gmx.net> (raw)

Hi,

Server:  Postgresql 7.4.3 on Cygwin while playing around
pg-odbc driver:   7.03.02.09
windows 2000
access 2000

I ask here since the problem seems not to exist on Microsofts SQL Server 
and don't want to get flamed for not using it.

I trying to get a deeper look into transactions with postgres. Up until 
now I dumped our data into plain access-mdb without concurrency control 
and hoped for the best.
Now I'm moving the backend to postgres and I want to do it "right".
I'll use unconnected forms that fetch their data content on open via 
ADODB Connection and Recordeset objects:
Naivly I began like this ...

BEGIN
SELECT * FROM sometable WHERE id = 123 FOR UPDATE
on close of the form I'll write the data back and COMMIT.
Sounds easy enough.
I expected to see an error in any concurring form that wants to fetch 
the same data.

Now I tried 2 open Access-MDBs (users) that do this. I sat a breakpoint 
after the "SELECT...FOR UPDATE" of MDB1 to look what happens in MDB2.
MDB2 stalls in it's own "SELECT...FOR UPDATE" line until MDB1 commits.

It might be OK, that user2 at the same time can't see the same record as 
user1 but user2 should be informed that there is a lock and that he 
can't change anything for now.
Access just stops processing and waits for the return of the SELECT.
I can't do anything until the warning would be obsolete anyway.

I tried setting:
    Set obj_conn_ado = New ADODB.Connection
    obj_conn_ado.CommandTimeout = 5
    obj_conn_ado.ConnectionTimeout = 5

So there should be a timeout raised after any 5 seconds of thumb 
twiddling as far as I understood the documentation I found with google.
Then I tried using a Command object

    Dim objCmd As ADODB.Command
    Set objCmd = New ADODB.Command
    objCmd.ActiveConnection = obj_conn_ado
    objCmd.CommandTimeout = 1
This should set the TimeOut to 1 second.

Still the second vba-procedure runs to the SELECT and drops dead.

What can I do to get an error-message instead of a deadlock ?





Message-ID: <41560237.3010205@gmx.net>
Permalink:  ../41560237.3010205@gmx.net/
Also on:    postgresql.org/message-id/41560237.3010205@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: maps.on@gmx.net
  Subject: Re: concurrency with adodb & ms-access
  In-Reply-To: <41560237.3010205@gmx.net>
  References: <41560237.3010205@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox