Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-05

Postgres Dlls not found

29 messages · 10 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dave Coventry

I'm flumoxed!

My app fails with the error "Cannot load Postgres Client. Is it installed? (libpg.dll)".

I've been developing my app on my laptop and initiallly was unable to get PQConnection working as it complained that Postgres was not installed.

I eventually loaded pgadmin3 onto my laptop, but the problem was only cured when I copied the ALL of the DLLs in the pgadmin install into my System32 folder.

I wasn't all that happy about it, but felt that I could live with having to copy 18 DLL files into the client's System32 directory.

However, the clients machines have all failed with the above error.

Copying the DLLs into system32 didn't help. And niether did installing pgadmin3, the error persists.

Does anyone have any idea why? Where does PQConnection expect to find the DLLs?

Reply by email

Marc Weustink
to Dave Coventry
Dave Coventry wrote 12 lines
I'm flumoxed! My app fails with the error "Cannot load Postgres Client. Is it installed? (libpg.dll)". I've been developing my app on my laptop and initiallly was unable to get PQConnection working as it complained that Postgres was not installed. I eventually loaded pgadmin3 onto my laptop, but the problem was only cured when I copied the ALL of the DLLs in the pgadmin install into my System32 folder.

Better not copy he dlls, just add the postgres/bin dir to your path (mycomputer-properties-advanced-environmentvars).
(sometimes you need to restart the explorer to load your new envirenment)

Show quoted text 7 lines
I wasn't all that happy about it, but felt that I could live with having to copy 18 DLL files into the client's System32 directory. However, the clients machines have all failed with the above error. Copying the DLLs into system32 didn't help. And niether did installing pgadmin3, the error persists.

did running pgadmin3 work ?

Does anyone have any idea why? Where does PQConnection expect to find the DLLs?

Like any other app as specified here:
http://msdn.microsoft.com/en-us/library/ms682586(VS.85).aspx

Marc

Reply by email

Dave Coventry
to Marc Weustink
Marc Weustink wrote
Better not copy he dlls, just add the postgres/bin dir to your path (mycomputer-properties-advanced-environmentvars). (sometimes you need to restart the explorer to load your new envirenment)

Yes, I tried that, but it didn't work.

did running pgadmin3 work ?

Yes it does.

Well, it says that the first place the dlls are searched for is in the application's own directory, but I have tried this without success.

Could it be that the path of reqired DLLs are hard-coded into PQConnection?

If that isn't the case, then it can only be that there is a dll missing, surely?

Pgadmin3 came with 18 DLLs all of which have been copied into the system32 directory, the executable's own directory and all paths to the DLLs have been added to the Path Environment variable.

Reply by email

Michael Van Canneyt
to Dave Coventry
Dave Coventry wrote 21 lines
On Thu, May 29, 2008 at 3:47 PM, Marc Weustink wrote: > Better not copy he dlls, just add the postgres/bin dir to your path > (mycomputer-properties-advanced-environmentvars). > (sometimes you need to restart the explorer to load your new envirenment) Yes, I tried that, but it didn't work. > did running pgadmin3 work ? Yes it does. > Like any other app as specified here: > http://msdn.microsoft.com/en-us/library/ms682586(VS.85).aspx Well, it says that the first place the dlls are searched for is in the application's own directory, but I have tried this without success. Could it be that the path of reqired DLLs are hard-coded into PQConnection? If that isn't the case, then it can only be that there is a dll missing, surely? Pgadmin3 came with 18 DLLs all of which have been copied into the system32 directory, the executable's own directory and all paths to the DLLs have been added to the Path Environment variable.

And did you find the dll that was specified in the error message ? There are some issues with the exact naming: the names have changed over time. The library should be named exactly as in the error message.

Michael.

Reply by email

Michael Van Canneyt
to Dave Coventry
Dave Coventry wrote 11 lines
Maybe I'm missing a DLL. Here are the DLLs that came with pgadmin3. comerr32.dll gssapi32.dll iconv.dll k5sprt32.dll krb5_32.dll libeay32.dll libiconv2.dll libintl3.dll libpq.dll

If I'm correct, the message mentioned libpg.dll ? Try renaming this dll.

Michael.

Show quoted text 14 lines
libxml2.dll libxslt.dll msvcm80.dll msvcp80.dll msvcr71.dll msvcr80.dll pgaevent.dll ssleay32.dll zlib1.dll _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Juan Cortés Cuesta
to Dave Coventry: I'm flumoxed! My app fails with the error "Cannot load Postgres Client. Is it installed?…

Hi!

18 dlls??

I had the same problem with PostgreSQL 8.2.5 in my developer PC. You only need to copy in System32 or other Directory

comerr32.dll
krb5_32.dll
libeay32.dll
libiconv-2.dll
libintl-2.dll
libpq.dll
ssleay32.dll

(I am not sure if dlls names are the same in your version)

If the Directory is not System32 needs Add it in your System PATH variable

I am sure it works.

Best regards,

Juan

Dave Coventry wrote 27 lines
I'm flumoxed! My app fails with the error "Cannot load Postgres Client. Is it installed? (libpg.dll)". I've been developing my app on my laptop and initiallly was unable to get PQConnection working as it complained that Postgres was not installed. I eventually loaded pgadmin3 onto my laptop, but the problem was only cured when I copied the ALL of the DLLs in the pgadmin install into my System32 folder. I wasn't all that happy about it, but felt that I could live with having to copy 18 DLL files into the client's System32 directory. However, the clients machines have all failed with the above error. Copying the DLLs into system32 didn't help. And niether did installing pgadmin3, the error persists. Does anyone have any idea why? Where does PQConnection expect to find the DLLs? _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Jalal

I have only found these DLLs needed for a PostgreSQL client connection:

libpq.dll
libeay32.dll
libiconv-2.dll
libintl-2.dll
comerr32.dll
krb5_32.dll
ssleay32.dll

The client program only accesses libpq.dll directly, but libpq appears to use the other DLLs listed above.

There is no hard-coded path in libpq, I haven't seen anything such short-sightedness on the part of the PostgreSQL develpment team. They have done excellent work, and both PostgreSQL and libpq are documented quite well in html.

From your other messages it appears you are still using Lazarus db components, which is fine. In this case the FPC/Lazarus team has already done the interfacing to libpq for you.

But you still need libpq.dll and supporting DLLs above.

Windows will search for a requested DLL first in the current folder, then folders in the search PATH. Nothing new here, and nothing special for libpq.

Also, for the record, installing a Verifone application called "PC Charge" can throw your PostgreSQL client because Verifone decided to name one of their DLLs libpq.dll and put in in the windows system folder (idiotic in this day) along with a slew of other DLLs to add to the mess.

I'm glad to see you found the circular reference in your query component.

Be persistent and work it out.

Earlier message 28 lines
From: "Dave Coventry" To: "General mailing list" Date: Thu, 29 May 2008 17:26:20 +0200 Subject: Re: [Lazarus] Postgres Dlls not found Maybe I'm missing a DLL. Here are the DLLs that came with pgadmin3. comerr32.dll gssapi32.dll iconv.dll k5sprt32.dll krb5_32.dll libeay32.dll libiconv2.dll libintl3.dll libpq.dll libxml2.dll libxslt.dll msvcm80.dll msvcp80.dll msvcr71.dll msvcr80.dll pgaevent.dll ssleay32.dll zlib1.dll -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20080529/4e3414e1/attachment.html

Reply by email

Dave Coventry
to Jalal

2008/5/29 Jalal :

There is no hard-coded path in libpq, I haven't seen anything such short-sightedness on the part of the PostgreSQL develpment team. They have done excellent work, and both PostgreSQL and libpq are documented quite well in html.

Jalal, your input has definitely assisted my project and for this I'm very grateful.
I hope I'm not accusing anyone of shortsightedness.

Also, for the record, installing a Verifone application called "PC Charge" can throw your PostgreSQL client because Verifone decided to name one of their DLLs libpq.dll and put in in the windows system folder (idiotic in this day) along with a slew of other DLLs to add to the mess.

The client machines are 'out of the box' and have no other software installed.

I'm glad to see you found the circular reference in your query component.

I was really confused about that. I didin't think that there were any circular references, but removing the Tdatasource component, as you suggested certainly made it work.

Be persistent and work it out.

Unfortunately I have very little time; my principals are due to place the order for the proprietary software tomorrow morning....

Reply by email

Joost van der Sluis
to Dave Coventry

Op donderdag 29-05-2008 om 22:24 uur [tijdzone +0200], schreef Dave Coventry:

Show quoted text 9 lines
> Also, for the record, installing a Verifone application called "PC Charge" > can throw your PostgreSQL client because Verifone decided to name one of > their DLLs libpq.dll and put in in the windows system folder (idiotic in > this day) along with a slew of other DLLs to add to the mess. The client machines are 'out of the box' and have no other software installed.

You didn't mix up 64-bit and 32-bit dlls accidentally?

Joost

Reply by email

Jalal

Dave,

My comments were to assure you that libpq and PostgreSQL work well. There is simply a learning curve for something new. I faced a curve when I jumped into Lazarus (from Delphi) and PostgreSQL (from MSSQL), and I still use all of the above.

I am not a developer of any of the products discussed here.

I mentioned PC Charge only as a general FYI for anyone interested.

There have been times when we lost a customer because there was something they wanted that we could not produce in time for their schedule.

Earlier message 31 lines
From: "Dave Coventry" To: "General mailing list" Date: Thu, 29 May 2008 22:24:49 +0200 Subject: Re: [Lazarus] Postgres Dlls not found 2008/5/29 Jalal : > There is no hard-coded path in libpq, I haven't seen anything such > short-sightedness on the part of the PostgreSQL develpment team. They have > done excellent work, and both PostgreSQL and libpq are documented quite well > in html. Jalal, your input has definitely assisted my project and for this I'm very grateful. I hope I'm not accusing anyone of shortsightedness. > Also, for the record, installing a Verifone application called "PC Charge" > can throw your PostgreSQL client because Verifone decided to name one of > their DLLs libpq.dll and put in in the windows system folder (idiotic in > this day) along with a slew of other DLLs to add to the mess. The client machines are 'out of the box' and have no other software installed. > I'm glad to see you found the circular reference in your query component. I was really confused about that. I didin't think that there were any circular references, but removing the Tdatasource component, as you suggested certainly made it work. > Be persistent and work it out. Unfortunately I have very little time; my principals are due to place the order for the proprietary software tomorrow morning.... -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20080529/e2ec4d56/attachment.html

Reply by email

Michael Van Canneyt
to Unknown author
Show quoted text 8 lines
On 5/29/08, Joost van der Sluis wrote: > You didn't mix up 64-bit and 32-bit dlls accidentally? Well I installed pgadmin3 on the machine and it runs. I copied ALL 18 dlls from the C:\Program Files\pgadminIII\ Directory into System32\ and, when I start my app it generates an error message asking for libpg.dll.

Try to copy the libraries in the directory of your application.

The procedure to load the library uses a straight windows loadLibrary call, as can be seen from the following:

Procedure InitialiseDllist;
begin
  inc(RefCount);
  if RefCount = 1 then
    begin
    DllistLibraryHandle := loadlibrary(pqlib);
    if DllistLibraryHandle = nilhandle then
      begin
      RefCount := 0;
      Raise EInOutError.Create('Can not load PosgreSQL client. Is it installed? ('+pqlib+')');
      end;

So normally it should find it.

Michael.

Reply by email

Unknown author
to Unknown author: Well I installed pgadmin3 on the machine and it runs. I copied ALL 18 dlls from the…

I don't know what more I can try.

It doesn't make sense.

Why should the laptop be able to run when the DLLs are copied to the system32 directory, yet the Desktop clients are generating an error message which says that the Postgres Client is not installed (libpq.dll).

Could it be that the error message is misleading? Might it be something else which is tripping up the app?

Show quoted text 9 lines
On 5/29/08, Joost van der Sluis wrote: > You didn't mix up 64-bit and 32-bit dlls accidentally? Well I installed pgadmin3 on the machine and it runs. I copied ALL 18 dlls from the C:\Program Files\pgadminIII\ Directory into System32\ and, when I start my app it generates an error message asking for libpg.dll.

Reply by email

Unknown author
to Unknown author

I have not followed your thread, just a simple idea: maybe there is a full path reference somewhere (Registry, cfg or ini files, ...) to some of the required files.

- Leslie -

Earlier message 34 lines
----- Original Message ----- From: To: "General mailing list" Sent: Friday, May 30, 2008 9:11 AM Subject: Re: [Lazarus] Postgres Dlls not found >I don't know what more I can try. > > It doesn't make sense. > > Why should the laptop be able to run when the DLLs are copied to the > system32 directory, yet the Desktop clients are generating an error > message which says that the Postgres Client is not installed > (libpq.dll). > > Could it be that the error message is misleading? Might it be > something else which is tripping up the app? > > On 5/30/08, wrote: >> On 5/29/08, Joost van der Sluis wrote: >>> You didn't mix up 64-bit and 32-bit dlls accidentally? >> >> Well I installed pgadmin3 on the machine and it runs. >> >> I copied ALL 18 dlls from the C:\Program Files\pgadminIII\ Directory >> into System32\ and, when I start my app it generates an error message >> asking for libpg.dll. >> > _______________________________________________ > Lazarus mailing list > > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus >

Reply by email

Unknown author
to Jalal: I have only found these DLLs needed for a PostgreSQL client connection: libpq.dll…
Jalal wrote 9 lines
I have only found these DLLs needed for a PostgreSQL client connection: libpq.dll libeay32.dll libiconv-2.dll libintl-2.dll comerr32.dll krb5_32.dll ssleay32.dll

Of these, libiconv-2.dll is on neither my laptop, nor the client desktops, however, libiconv.dll is on both, typo?

libintl-2.dll is not on the Desktop client, but it IS on my laptop as part of Inkscape. However, copying it to the Desktop does not help.

libintl3.dll, is present, as part of the pgadmin3 installation listed below.

Show quoted text 18 lines
comerr32.dll gssapi32.dll iconv.dll k5sprt32.dll krb5_32.dll libeay32.dll libiconv2.dll libintl3.dll libpq.dll libxml2.dll libxslt.dll msvcm80.dll msvcp80.dll msvcr71.dll msvcr80.dll pgaevent.dll ssleay32.dll zlib1.dll

Reply by email

Søren Ager
to Unknown author: I don't know what more I can try. It doesn't make sense. Why should the laptop be able to…
Why should the laptop be able to run when the DLLs are copied to the system32 directory, yet the Desktop clients are generating an error message which says that the Postgres Client is not installed (libpq.dll).

The load can fail if libpg.dll or one of the dlls it uses does not exist on the PC. Try opening libpg.dll with http://www.dependencywalker.com/ and check that all the dlls it lists exist on the PC

Greetings
S?ren

Reply by email

Unknown author
to Søren Ager

Soren, for a moment there I thought the Dependency Walker was the answer to my problems, but it appears that it is a snare and a delusion.

It lists different DLLs as being missing on the working system and on the borked system.

Some of the DLLs which are listed as present are not in either system.

MSJAVA.DLL, for example is listed as present on the working system, but missing on the borked system, when it is present in niether.

Nowhere is libpq.dll (or any of the other DLLs mentioned on this thread) listed by Dependancy Walker on either system.

Is there a more reliable way of working out which DLLs are required by the program?

I have wasted 2 days (and almost 2 nights) trying to figure out what is going on and am very close to giving up entirely.

S?ren Ager wrote 24 lines
wrote: > Why should the laptop be able to run when the DLLs are copied to the > system32 directory, yet the Desktop clients are generating an error > message which says that the Postgres Client is not installed > (libpq.dll). The load can fail if libpg.dll or one of the dlls it uses does not exist on the PC. Try opening libpg.dll with http://www.dependencywalker.com/ and check that all the dlls it lists exist on the PC Greetings S?ren _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Michael Van Canneyt
to Unknown author
Show quoted text 17 lines
Soren, for a moment there I thought the Dependency Walker was the answer to my problems, but it appears that it is a snare and a delusion. It lists different DLLs as being missing on the working system and on the borked system. Some of the DLLs which are listed as present are not in either system. MSJAVA.DLL, for example is listed as present on the working system, but missing on the borked system, when it is present in niether. Nowhere is libpq.dll (or any of the other DLLs mentioned on this thread) listed by Dependancy Walker on either system. Is there a more reliable way of working out which DLLs are required by the program?

If it is about the FPC program: no. The program loads the library dynamically. The best you can do is list the dependencies of libpq.dll, and make sure these are present on both systems.

Michael.

Reply by email

Marc Santhoff
to Unknown author: Soren, for a moment there I thought the Dependency Walker was the answer to my problems,…
Show quoted text 20 lines
Soren, for a moment there I thought the Dependency Walker was the answer to my problems, but it appears that it is a snare and a delusion. It lists different DLLs as being missing on the working system and on the borked system. Some of the DLLs which are listed as present are not in either system. MSJAVA.DLL, for example is listed as present on the working system, but missing on the borked system, when it is present in niether. Nowhere is libpq.dll (or any of the other DLLs mentioned on this thread) listed by Dependancy Walker on either system. Is there a more reliable way of working out which DLLs are required by the program? I have wasted 2 days (and almost 2 nights) trying to figure out what is going on and am very close to giving up entirely.

Do you know that page?:

http://www.postgresql.org/docs/8.2/interactive/install-win32.html

On other systems there may be a client-only-package (FreeBSD and Debian at least).

HTH,
Marc

Reply by email

Unknown author
to Marc Santhoff

Michael, Marc, Soren, Jalal, Joost et al,

Thanks very much for your assistance.

I ran Dependency Walker on the libpq.dll and found there was some kind of error on the file, so I deleted all instances of libpq.dll on the system (I had ended up with 4 or 5 copies of the file with all my experimentation) except the ones in the pgadminIII directory.

I added the pgadminIII directory to the PATH environment variable, and ....

...It wotks!

Without wanting to sound churlish, I am a bit of a loss to understand why the PQconnection needs to use the libpq.dll in the first place. I'm sure a lot of the Queries could be handled by communicating directly with the psql command line through ssh.

Reply by email

Michael Van Canneyt
to Unknown author
Show quoted text 17 lines
Michael, Marc, Soren, Jalal, Joost et al, Thanks very much for your assistance. I ran Dependency Walker on the libpq.dll and found there was some kind of error on the file, so I deleted all instances of libpq.dll on the system (I had ended up with 4 or 5 copies of the file with all my experimentation) except the ones in the pgadminIII directory. I added the pgadminIII directory to the PATH environment variable, and .... ...It wotks! Without wanting to sound churlish, I am a bit of a loss to understand why the PQconnection needs to use the libpq.dll in the first place. I'm sure a lot of the Queries could be handled by communicating directly with the psql command line through ssh.
You could try to do this;
But it would be horribly inefficient, making it totally unusable.

The recommended programmer's interface is libpq.dll, so that is what we use. The problems you experienced are what is known as DLL hell, and occur under many circumstances, not just with PostGreSQL.

Michael.

Reply by email

Michael Van Canneyt
to Dave Coventry
Dave Coventry wrote 6 lines
Yes, DLL hell it is. That's why I was dismayed to see that PQconnection used the DLL (and not just one, it uses several). But I suppose if there's a good reason for it....

All database interfaces always should use a DLL.
That's what they are for, after all.

Alas, theory and practice are not always on par :-)

Michael.

Reply by email

Marc Santhoff
to Dave Coventry: Yes, DLL hell it is. That's why I was dismayed to see that PQconnection used the DLL (and…
Dave Coventry wrote 6 lines
Yes, DLL hell it is. That's why I was dismayed to see that PQconnection used the DLL (and not just one, it uses several). But I suppose if there's a good reason for it....

Most databases do it that way, e.g. Firebird and MySQL do have a client side installation relying on a dll/so, too.

The library is the communication stub on the client side. Inside there is the implementation of the communication protocoll which is mostly unique for each sql server.

If the communication was done using the command line this would involve a shell, the utility program and ssh/ssl. Looking at ssh would be using what? A library implementing the communication protocoll on the client side ... but one had to deal with moving query and result to and from a TProcess or something. How would you do that when multiple result were to transfer from the server? What if the variable $LANG was set by the user? Do the lines transferrred as text end on #10, #13 or #10 + #13? How would error codes from the server or the connection shell would be differentiated from each other and handled?

Having a library eliminating a lot of such problems and encapsulating the rest is not that bad. It costs you having to care for one thing: the client computer has to have the correct dll/so or client package installed that fits the server version in use.

Regards,
Marc

Reply by email

Damien Gerard
to Dave Coventry: Yes, DLL hell it is. That's why I was dismayed to see that PQconnection used the DLL (and…

Le May 31, 2008 ? 1:31 PM, Dave Coventry a ?crit :

Show quoted text 6 lines
Yes, DLL hell it is. That's why I was dismayed to see that PQconnection used the DLL (and not just one, it uses several). But I suppose if there's a good reason for it....

Yes you can update it (security vulnerabilities for example) without updating the whole app.
It is important for big apps.

Damien Gerard "Intelligence is 10 million rules." -- Douglas Lenat

Reply by email

Marc Weustink
to Unknown author: Michael, Marc, Soren, Jalal, Joost et al, Thanks very much for your assistance. I ran…

wrote:

[snip]

Without wanting to sound churlish, I am a bit of a loss to understand why the PQconnection needs to use the libpq.dll in the first place. I'm sure a lot of the Queries could be handled by communicating directly with the psql command line through ssh.

Besides other disadvantages.... a windows machine hasn't ssh either, so those exe/dlls need to be installed too. So you still need some installation.

Marc

Reply by email

Dave Coventry
to Marc Weustink

Telnet?

Marc Weustink wrote 20 lines
wrote: [snip] > Without wanting to sound churlish, I am a bit of a loss to understand > why the PQconnection needs to use the libpq.dll in the first place. > I'm sure a lot of the Queries could be handled by communicating > directly with the psql command line through ssh. Besides other disadvantages.... a windows machine hasn't ssh either, so those exe/dlls need to be installed too. So you still need some installation. Marc _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email