Sign in Join

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

Mailing lists / fpc-pascal / 2006-09

TDatabase, PostgreSQL and Mac OS X?

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Jeremy Cowgar

I have the following simple program that does not seem to be working. Connectivity using postgres unit works fine. Here's the error and then the program will follow. Thank you! Oh, a note. I do not have libpq.so. I do have libpq.dylib. Also, my postgresql is installed in a non-standard place, /usr/local/pgsql however other programs have not had a problem with that thus far. I created symlinks to /usr/ local/pgsql/libpq* into /usr/lib but that did not solve the problem.

Jeremy

------------
$ ./dbtest Connecting to database...
An unhandled exception occurred at $0007864C :
EInOutError : Can not load PosgreSQL client. Is it installed? (libpq.so) $0007864C
$00054F87

------------

program dbtest;
uses sqldb, pqconnection;
var
	Fconnection  : tSQLConnection;
begin
	writeln('Connecting to database...');
	Fconnection := tpqConnection.Create(nil);
	with Fconnection do
	begin
		DatabaseName := 'test';
		open;
	end;
	writeln('Connected...');
	Fconnection.Free;
end.
Leonardo M. Ram�
to Jeremy Cowgar

I don't know too much about OS X, but can't you simply rename libpq.dylib to libpq.so?

--- Jeremy Cowgar wrote 45 lines
I have the following simple program that does not seem to be working. Connectivity using postgres unit works fine. Here's the error and then the program will follow. Thank you! Oh, a note. I do not have libpq.so. I do have libpq.dylib. Also, my postgresql is installed in a non-standard place, /usr/local/pgsql however other programs have not had a problem with that thus far. I created symlinks to /usr/ local/pgsql/libpq* into /usr/lib but that did not solve the problem. Jeremy ------------ $ ./dbtest Connecting to database... An unhandled exception occurred at $0007864C : EInOutError : Can not load PosgreSQL client. Is it installed? (libpq.so) $0007864C $00054F87 ------------ program dbtest; uses sqldb, pqconnection; var Fconnection : tSQLConnection; begin writeln('Connecting to database...'); Fconnection := tpqConnection.Create(nil); with Fconnection do begin DatabaseName := 'test'; open; end; writeln('Connected...'); Fconnection.Free; end. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Leonardo M. Ramé
http://leonardorame.blogspot.com

__________________________________________________ Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

Jeremy Cowgar
to Leonardo M. Ram�

Leonardo, Wow. That worked. I did a symlink from libpq.dylib to libpq.so and it works now.

Is there a proper way to do this on mac os x anyone?

Thanks Lenardo!

Jeremy

Leonardo M. Ramé wrote 63 lines
I don't know too much about OS X, but can't you simply rename libpq.dylib to libpq.so? --- Jeremy Cowgar wrote: > I have the following simple program that does not seem to be working. > Connectivity using postgres unit works fine. Here's the error and > then the program will follow. Thank you! Oh, a note. I do not have > libpq.so. I do have libpq.dylib. Also, my postgresql is installed in > a non-standard place, /usr/local/pgsql however other programs have > not had a problem with that thus far. I created symlinks to /usr/ > local/pgsql/libpq* into /usr/lib but that did not solve the problem. > > Jeremy > > ------------ > $ ./dbtest Connecting to database... > An unhandled exception occurred at $0007864C : > EInOutError : Can not load PosgreSQL client. Is it installed? > (libpq.so) > $0007864C > $00054F87 > > ------------ > > program dbtest; > > uses sqldb, pqconnection; > > var > Fconnection : tSQLConnection; > > begin > writeln('Connecting to database...'); > > Fconnection := tpqConnection.Create(nil); > with Fconnection do > begin > DatabaseName := 'test'; > open; > end; > > writeln('Connected...'); > > Fconnection.Free; > end. > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > Leonardo M. Ramé http://leonardorame.blogspot.com __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Vincent Snijders
to Jeremy Cowgar
Jeremy Cowgar wrote 7 lines
Leonardo, Wow. That worked. I did a symlink from libpq.dylib to libpq.so and it works now. Is there a proper way to do this on mac os x anyone? Thanks Lenardo!

Maybe apply this patch and recompile:

Index: base/postgres/dllistdyn.pp
=================================================================== --- base/postgres/dllistdyn.pp (revision 4739)
+++ base/postgres/dllistdyn.pp (working copy)
@@ -15,9 +15,14 @@

  {$PACKRECORDS C}
  {$IFDEF Unix}
+{$IFDEF Darwin}
    const
+    pqlib = 'libpq.dylib';
+{$ELSE}
+  const
      pqlib = 'libpq.so';
  {$ENDIF}
+{$ENDIF}
  {$IFDEF Windows}
    const
      pqlib = 'libpq.dll';
Index: base/postgres/postgres3dyn.pp
===================================================================
--- base/postgres/postgres3dyn.pp	(revision 4739)
+++ base/postgres/postgres3dyn.pp	(working copy)
@@ -15,9 +15,14 @@
    dynlibs, SysUtils, dllistdyn;
  {$IFDEF Unix}
+{$IFDEF Darwin}
    const
+    pqlib = 'libpq.dylib';
+{$ELSE}
+  const
      pqlib = 'libpq.so';
  {$ENDIF}
+{$ENDIF}
  {$IFDEF Win32}
    const
      pqlib = 'libpq.dll';

Vincent

Leonardo M. Ram�
to Jeremy Cowgar: Leonardo, Wow. That worked. I did a symlink from libpq.dylib to libpq.so and it works now.

Well, congratulations. I've experienced that same problem trying to use the ZeosLib PostGresql protocol on Linux. It try to use libpq.so and i had libpq-x.x.so, so i created a smart link to it.

--- Jeremy Cowgar wrote 79 lines
Leonardo, Wow. That worked. I did a symlink from libpq.dylib to libpq.so and it works now. Is there a proper way to do this on mac os x anyone? Thanks Lenardo! Jeremy On Sep 27, 2006, at 7:55 AM, Leonardo M. Ramé wrote: > I don't know too much about OS X, but can't you simply rename > libpq.dylib to libpq.so? > > --- Jeremy Cowgar wrote: > >> I have the following simple program that does not seem to be working. >> Connectivity using postgres unit works fine. Here's the error and >> then the program will follow. Thank you! Oh, a note. I do not have >> libpq.so. I do have libpq.dylib. Also, my postgresql is installed in >> a non-standard place, /usr/local/pgsql however other programs have >> not had a problem with that thus far. I created symlinks to /usr/ >> local/pgsql/libpq* into /usr/lib but that did not solve the problem. >> >> Jeremy >> >> ------------ >> $ ./dbtest Connecting to database... >> An unhandled exception occurred at $0007864C : >> EInOutError : Can not load PosgreSQL client. Is it installed? >> (libpq.so) >> $0007864C >> $00054F87 >> >> ------------ >> >> program dbtest; >> >> uses sqldb, pqconnection; >> >> var >> Fconnection : tSQLConnection; >> >> begin >> writeln('Connecting to database...'); >> >> Fconnection := tpqConnection.Create(nil); >> with Fconnection do >> begin >> DatabaseName := 'test'; >> open; >> end; >> >> writeln('Connected...'); >> >> Fconnection.Free; >> end. >> >> _______________________________________________ >> fpc-pascal maillist - >> http://lists.freepascal.org/mailman/listinfo/fpc-pascal >> > > > Leonardo M. Ramé > http://leonardorame.blogspot.com > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Leonardo M. Ramé
http://leonardorame.blogspot.com

__________________________________________________ Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com