Zeos ZConnection problems with PostgreSQL lazarus / 16-Databases ---------------------------------------------------------------------- JD · 2016-03-16 13:09 Hi there everyone, I'm having a rather curious problem. I use Zeos 7.2 RC along with Lazarus 1.6/FPC 3.0 Win32. I also have PostgreSQL 9.5.1 Win32 installed. I wanted to connect to a PostgreSQL database in the Lazarus IDE using TZTable & TZQuery and browse the results in a DBGrid. Anytime I try to set TZConnection's Connected property to True, I get the error in the attached image below saying libpq.dll was found BUT could not be loaded. Check compile target & library compatibility. It can't be a 32bit/64bit issue because everything I use for development is 32bit. In addition, the same test program works without problems when I replace Zeos components with SQLdb components shipped with Lazarus. Thanks for your assistance with resolving this issue. JD ---------------------------------------------------------------------- goodname · 2016-03-16 13:26 The libpq.dll actually depends on a number of other dll's. It is possible that the other dll's are not being found. ---------------------------------------------------------------------- rvk · 2016-03-16 13:40 Or that the other found dll's are invalid. Like a wrong version of ssleay32.dll in the Windows/System32 or something. I think libpq.dll is depended on (if this list is still current): comerr32.dll gssapi32.dll k5sprt32.dll krb5_32.dll libeay32.dll libiconv2.dll libintl3.dll msvcr80.dll ssleay32.dll https://pgolub.wordpress.com/2008/12/15/building-postgresql-client- library-using-mingw-under-winxp-sp3/ ---------------------------------------------------------------------- JD · 2016-03-16 14:03 I've actually posted the issue on Zeos' forum also because like I said Lazarus' SQLDb components connect & show data without problems. I am also able to administer PostgreSQL databases using both dBeaver and pgAdmin. So I don't think it is a case of missing dlls. I'm still looking into this curious issue. JD ---------------------------------------------------------------------- rvk · 2016-03-16 14:48 You could try setting TZConnection's Connected property to True in code and directly after it (after the error) read out GetLastError. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ZConnection.Connected := true;Showmessage(IntToStr(GetLastError)); A failed LoadLibrary would leave it's errorcode behind in LastError. Maybe it gives a more clear description (after searching the internet for the numbercode ) ---------------------------------------------------------------------- miab3 · 2016-03-17 12:05 I tried copy client libraries from PostgreSQL 9.5.1.1-32 zlib1.dll libeay32.dll libiconv-2.dll libintl-8.dll libpq.dll libxml2.dll libxslt.dll ssleay32.dll in the application directory (ZEOS 7.2.1-rc, LAZARUS 1.6-Win32) and connect to the server (9.3) without problems. I see that it is also used msvcr120.dll. Michal ---------------------------------------------------------------------- JD · 2016-04-11 09:47 I only just saw this today. Thanks a lot for your replies. Following miab3's advice, I copied the files to the project's main directory. While I was able to connect successfully, I was unable to browse a table in DBGrid using ZTable. When I click on any row in the grid or try to scroll, I get the dreaded SIGSEGV exception! See attached. I tried using ZQuery & then the project hung when I tried to set ZQuery active i.e Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ZQuery.Active := True. The funny thing is everything works fine with SQLdb components even without copying all these files around. JD ---------------------------------------------------------------------- tsr · 2016-04-19 21:05 Share some simple test application with this issue please. I will look at it. Do you try it on different operating system? ---------------------------------------------------------------------- miab3 · 2016-04-20 23:38 @JD, See what works for me ZEOS 7.2 (7.3): http://zeoslib.sourceforge.net/viewtopic.php?f=40&t=3795&p=61481#p6065 6 Michal