Visual Basic/ODBC/PostgreSQL

From: "Cesar A(dot) K(dot) Grossmann" <cesar(at)rotnet(dot)com(dot)br>
To: pgsql-general(at)postgresql(dot)org
Subject: Visual Basic/ODBC/PostgreSQL
Date: 2000-07-04 14:22:16
Message-ID: 3961F318.CE848935@rotnet.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

I'm having troubles in changing an application that was written in
Visual Basic. It originally accesses a MS Access database file, via Jet,
and I'm helping the programmer to change it to use ODBC to connect to a
PostgreSQL Server, running on top of a Linux Box.

The first problem I have was that the database was always opened as
"read-only". I don't know why, but when we added a primary key, then the
database can be opened to write. Another change was the configuration of
the ODBC driver, that I change to recognize indexed fields (or something
like this). This part is OK. The program can connect to the database,
and open records, changes it, and saves its changes.

The next problem, that I cannot figure how to correct, was to permit
multi-user access to the database. What I need is that when someone
opens one register to change it, all the other users cannot do the same,
until the changes are done.

I have tried the "BEGIN WORK/END", with "SELECT ... FOR UPDATE", but it
appears to have no effect on the database. Then I make it the difficult
way: I have created a field that, when filled, contains the username of
the user that have blocked the register. If the field is empty, then the
record can be changed. It works.

But I'm with some problems here: when someone send any command to the
database, no other user can even connect to it. If user 'A' and user 'B'
start the program at the same time, only one of them can connect. The
other gets an error and must try again. New attempt and it's OK, but I
think it's not the right way to do the job. I also noted at the Linux
that, when user 'A' is using the application, several instances of
postgres appears at the memory of the server. Is it normal?

Being able to do multi-user programming with Visual Basic and MDB files,
I think the changing to use a RDBMS is not straight, but I cannot figure
out what the changes I need to do, or the right way to program an
application this way. The help files that come with Visual Basic doesn't
help much. The documentation that comes with PostgreSQL presumes the
reader know how to program database applications (I'm thinking it's not
my case...).

Can someone points me some docs (I prefer on-line documents...) that can
help me (I think that teach basic database/multiuser programming is far
beyond the objective of the list, but I hope someone can tells me the
way I need to do these things)?

I'm using:
Visual Basic 5.0
PostgreSQL ODBC driver 6.5 ("Insight Distribution Systems")
PostgreSQL 7.0 (RPM binary distribution)
Conectiva Linux 5.0 (Linux 2.2.14)

TIA
--
Cesar A. K. Grossmann

Browse pgsql-general by date

  From Date Subject
Next Message Stephane Bortzmeyer 2000-07-04 14:38:21 Re: proposed improvements to PostgreSQL license
Previous Message Sergio A. Kessler 2000-07-04 14:11:12 Re: [HACKERS] proposed improvements to PostgreSQL license