pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feedRecord locking issue using ODBC from .NET
3+ messages / 2 participants
[nested] [flat]
* Record locking issue using ODBC from .NET
@ 2006-08-29 08:45 anomatos@freemail.gr
2006-08-29 23:39 ` Re: Record locking issue using ODBC from .NET Hiroshi Inoue <inoue@tpf.co.jp>
0 siblings, 1 reply; 3+ messages in thread
From: anomatos@freemail.gr @ 2006-08-29 08:45 UTC (permalink / raw)
To: pgsql-odbc
I want to have exclusive read access to a table row, so that if a client has access to that row, any other client should either wait or get an error of the type "could not obtain lock on row in relation 'customers'", depending on the semantics used in the query string(nowait)
Both clients execute:
...
OdbcTransaction ^ transaction = connection->BeginTransaction();
String ^ query = "select * from customers where id = 3 for update nowait";
OdbcCommand ^ cmd = (gcnew OdbcCommand(query, connection, transaction));
reader = cmd->ExecuteReader();
...
After the first client locks the record and before he ends the transaction, the second tries to acquire the lock. As expected an exception is raised, BUT:
One would expect that this exception is of type OdbcException explaining that "the lock cannot be aquired". Instead of this I get a System::InvalidOperationException which disables my connection for some reason. However the above exception hosts an inner exception of the desired type(OdbcException).
Does anybody have any idea why I get this type of behaviour, why is my connection closed?
Thanks a lot in advance,
Antonis
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Record locking issue using ODBC from .NET
2006-08-29 08:45 Record locking issue using ODBC from .NET anomatos@freemail.gr
@ 2006-08-29 23:39 ` Hiroshi Inoue <inoue@tpf.co.jp>
0 siblings, 0 replies; 3+ messages in thread
From: Hiroshi Inoue @ 2006-08-29 23:39 UTC (permalink / raw)
To: anomatos@freemail.gr; +Cc: pgsql-odbc
Hi Antonis,
Which version of driver are you using ?
regards,
Hiroshi Inoue
anomatos@freemail.gr wrote:
> I want to have exclusive read access to a table row, so that if a client has access to that row, any other client should either wait or get an error of the type "could not obtain lock on row in relation 'customers'", depending on the semantics used in the query string(nowait)
>
> Both clients execute:
>
> ...
> OdbcTransaction ^ transaction = connection->BeginTransaction();
> String ^ query = "select * from customers where id = 3 for update nowait";
> OdbcCommand ^ cmd = (gcnew OdbcCommand(query, connection, transaction));
> reader = cmd->ExecuteReader();
> ...
>
> After the first client locks the record and before he ends the transaction, the second tries to acquire the lock. As expected an exception is raised, BUT:
>
> One would expect that this exception is of type OdbcException explaining that "the lock cannot be aquired". Instead of this I get a System::InvalidOperationException which disables my connection for some reason. However the above exception hosts an inner exception of the desired type(OdbcException).
>
> Does anybody have any idea why I get this type of behaviour, why is my connection closed?
>
> Thanks a lot in advance,
> Antonis
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Record locking issue using ODBC from .NET
@ 2006-08-31 12:53 anomatos@freemail.gr
0 siblings, 0 replies; 3+ messages in thread
From: anomatos@freemail.gr @ 2006-08-31 12:53 UTC (permalink / raw)
To: pgsql-odbc
Please try the 8.2.0100 which would be released soon.
If you are in a hurry, please install the 8.2.0002 version at
http://pgfoundry.org/projects/psqlodbc/ .
regars,
Hiroshi Inoue
> anomatos@freemail.gr wrote:
> Hello there,
>
> I'm using version 8.01.02.00 of the PostgreSQL driver, any ideas?
>
>
> > Hi Antonis,
> > Which version of driver are you using ?
> >
> > regards,
> > Hiroshi Inoue
> >
> > > anomatos@freemail.gr wrote:
> > >
> > > I want to have exclusive read access to a table row, so that if a client
> > > has access to that row, any other client should either wait or get an
> > > error of the type "could not obtain lock on row in relation 'customers'",
> > > depending on the semantics used in the query string(nowait)
> > >
> > > Both clients execute:
> > >
> > > ...
> > > OdbcTransaction ^ transaction = connection->BeginTransaction();
> > > String ^ query = "select * from customers where id = 3 for update nowait";
> > > OdbcCommand ^ cmd = (gcnew OdbcCommand(query, connection, transaction));
> > > reader = cmd->ExecuteReader();
> > > ...
> > >
> > > After the first client locks the record and before he ends the transaction,
> > > the second tries to acquire the lock. As expected an exception is raised,
> > > BUT:
> > >
> > > One would expect that this exception is of type OdbcException explaining that
> > > "the lock cannot be aquired". Instead of this I get a
> > > System::InvalidOperationException which disables my connection for some
> > > reason. However the above exception hosts an inner exception of the desired
> > > type(OdbcException).
> > >
> > > Does anybody have any idea why I get this type of behaviour, why is my
> > > connection closed?
> > >
> > > Thanks a lot in advance, Antonis
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2006-08-31 12:53 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-08-29 08:45 Record locking issue using ODBC from .NET anomatos@freemail.gr
2006-08-29 23:39 ` Hiroshi Inoue <inoue@tpf.co.jp>
2006-08-31 12:53 Re: Record locking issue using ODBC from .NET anomatos@freemail.gr
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