Re: Driver compatibility - Mailing list pgsql-odbc

From Merlin Moncure
Subject Re: Driver compatibility
Date
Msg-id 6EE64EF3AB31D5448D0007DD34EEB3412A75C0@Herge.rcsinc.local
Whole thread Raw
In response to Driver compatibility  (Együd Csaba <csegyud@vnet.hu>)
List 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
swapout a dataset (ZDataset for TBDEDataset) and as long as the field names are the same, it should work the same.  You
canmix/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
betweenthe 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
partyMFC 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...thisis 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
loggingin as a superuser. 
3. Create a small app that queries pg_stat_activity (and logs on as superuser)...if connections are still high, start
killingthem 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



pgsql-odbc by date:

Previous
From: Együd Csaba
Date:
Subject: Re: Driver compatibility
Next
From: "Joost Kraaijeveld"
Date:
Subject: How to call a stored procedure in PostgreSQL