Re: Driver compatibility

From: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
To: Együd Csaba <csegyud(at)vnet(dot)hu>
Cc: "Pgsql-Odbc(at)Postgresql(dot)Org" <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: Driver compatibility
Date: 2005-01-19 13:30:28
Message-ID: 6EE64EF3AB31D5448D0007DD34EEB3412A75C0@Herge.rcsinc.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

> Yes I know Zeos, but I'm afraid it is too late to change to that because
> this project consists of 300 forms. It would be very very painful to
> rewrite...
>
> I think there must be some way to have both versions work on the same
> machine.
>
Yes. Zeos and BDE can't share the same connection object, but they can share everything else. For example, you can swap out a dataset (ZDataset for TBDEDataset) and as long as the field names are the same, it should work the same. You can mix/match different types of connections on the same app or even on the same form.

I was not aware you were using Delphi: your connection accumulation problem might be because of the bde. The bde sits between the database/odbc and your app and is buggy. It has been known to do things like open connections and not close them. Zeos communicates directly to postgres and bypasses both the BDE and ODBC layers. Of course, if you have a 3rd party MFC ODBC based library, it is not going through the BDE.

Unfortunately, I think you are going to have problems until you replace the BDE, either with Zeos or something else...this is the hard lesson that many Borland developers have to learn.

For a short term fix I would:
1. Turn statement level statistics on
2. configure postgres to reserve at least one connection for the superuser. Make you're your applications are not logging in as a superuser.
3. Create a small app that queries pg_stat_activity (and logs on as superuser)...if connections are still high, start killing them based on last activity. There is a backend function to do this, pq_kill_backend_pid or something like that.

For a longer term fix:
1. Move away from BDE. This is easier than you might think. You can do it gradually.
2. Construct an odbc test app (written in C) that demonstrates your problem. This will be a big help in getting it fixed, if it is odbc-specific.
3. Determine which process is holding the connections. Believe me, there is one.

Good luck!
Merlin

Browse pgsql-odbc by date

  From Date Subject
Next Message Kevin Puetz 2005-01-20 14:53:19 Re: 'No Current Record' using Access linked to Postgres via ODBC - A possible resolution
Previous Message Együd Csaba 2005-01-19 12:55:24 Re: Driver compatibility