Page 1 of 2

postgres

Posted: Sun Mar 17, 2019 9:07 pm
by kajot
if FW_OpenAdoConnection open postgres ?

best regards
KAJOT

Re: postgres

Posted: Mon Mar 18, 2019 2:15 am
by nageswaragunupudi
Yes.
First, you need to install either ODBC connector or preferably OLEDB provider for PostgreSQL.

Then
oCn := FW_OpenAdoConnection( cConnectionString, .t. )

Please refer to the documentation of www.connectionstrings.com to determine the correct connection string to be used.

Re: postgres

Posted: Tue Mar 19, 2019 11:23 am
by kajot
ask for an example , because none work

Re: postgres

Posted: Tue Mar 19, 2019 11:35 am
by kajot
with MSSQL works well

Re: postgres

Posted: Wed Apr 03, 2019 7:44 pm
by kajot
Does anyone use Postgres ?

Re: postgres

Posted: Wed Apr 03, 2019 8:17 pm
by nageswaragunupudi
If you have installed Postgre server on your computer, build the samples pgre01.prg and testpgre.prg in the fwh\samples folder. Go to the folder \fwh\samples and build with either buildh.bat or buildx.bat

Re: postgres

Posted: Wed Apr 03, 2019 10:44 pm
by nageswaragunupudi
I have just installed Postgre server on my PC.
Both the samples pgre01.prg and testpgre.prg worked for me.

I have also installed Postgre Oledb provider and I am able to connect to the server using ADO, with this connection string.

Code: Select all

Provider=PostgreSQL OLE DB Provider;Data Source=myServerAddress;
location=myDataBase;User ID=myUsername;password=myPassword;
 
Still testing with ADO. We propose to make improvements, where necessary, to the ado functions in the FWH version under release now.

Re: postgres

Posted: Thu Apr 04, 2019 5:24 pm
by kajot
in pgre01.prg and testpgre.prg occurs

TPQServer():New( cHost, cDataBase, cUser, cPassword, , cSchema )

when I compliling , I got error
xLINK: error: Unresolved external symbol '_HB_FUN_TPQSERVER referenced from (t.obj)'.
xLINK: error: Unresolved external symbol '_HB_FUN_PQEXEC referenced from (t.obj)'.

Re: postgres

Posted: Fri Apr 05, 2019 2:36 am
by nageswaragunupudi
please go to \fwh\samples folder.

If you are using xharbour, then buildx pgre01
If you are using harbour, then buildh pgre01.

You will not get any unresolved externals.

Re: postgres

Posted: Fri Apr 05, 2019 5:08 pm
by kajot
I am using xHarbour.com (simplex ) with Pelles ISO C compiler 3.0

and get error
xLINK: error: Unresolved external symbol '_HB_FUN_TPQSERVER referenced from (t.obj)'.

xLINK: error: Unresolved external symbol '_HB_FUN_PQEXEC referenced from (t.obj)'.

x

Re: postgres

Posted: Fri Apr 05, 2019 6:05 pm
by nageswaragunupudi
Both Harbour and xHarbour provide a library "pgsql.lib" for connecting to PostGre server.
So users of both free xHarbour and Harbour with bcc can straight away connect to PostGre server and start working with.

You need to link the pgsql.lib provided with your commerical xharbour.com
In addition, you need to create an implib for libpq.dll ( available in fwh\samples ) folder and link that too.

Re: postgres

Posted: Fri Apr 05, 2019 9:34 pm
by kajot
when I add pgsql from FWH s:\lib ( FWH there is in S:)

I get error
Type: C >>>xlink.exe -NOEXPOBJ -MAP -FORCE:MULTIPLE -NOIMPLIB -subsystem:windows -UNMANGLE -LIBPATH:"S:\lib" -LIBPATH:"R:\lib" -LIBPATH:"R:\c_lib" -LIBPATH:"R:\c_lib\win" "t.obj" "errorsys.obj" "mem32.lib" "send32.lib" "png.lib" "r:\c_lib\win\gdi32.lib" "r:\c_lib\win\gdiplus.lib" "xhbzip.lib" "xhbzipdll.lib" "xfw.lib" "s:\lib\pgsql.lib" "libpq.lib" "FiveHCM.lib" "FiveHMX.lib" "OptG.lib" "xhb.lib" "dbf.lib" "nsx.lib" "ntx.lib" "cdx.lib" "rmdbfcdx.lib" "ct3comm.lib" crt.lib kernel32.lib user32.lib winspool.lib ole32.lib oleaut32.lib odbc32.lib odbccp32.lib uuid.lib wsock32.lib ws2_32.lib wininet.lib advapi32.lib shlwapi.lib msimg32.lib mpr.lib OleDlg.lib version.lib comctl32.lib comdlg32.lib gdi32.lib shell32.lib winmm.lib lz32.lib Netapi32.lib -out:"t.EXE"<<<

xLINK: fatal error: Corrupt library: 's:\lib\pgsql.lib'.

Re: postgres

Posted: Fri Apr 05, 2019 9:54 pm
by nageswaragunupudi
The lib provided by FWH is for Harbour and xHarbour with bcc only. It is not compatible with your xhabour.com
As I said before you need to get it from xhabour.com's libs or build it yourself with xharbour.com's compiler from the contrib sources.

Re: postgres

Posted: Fri Apr 05, 2019 10:26 pm
by kajot
when I am using lib from xHarbour.com (R: there is path to xHARBOUR.COM)

[R:\lib\sql.lib]
[R:\lib\libpq.lib]

I get error

xLINK: error: Unresolved external symbol '_HB_FUN_TPQSERVER referenced from (t.obj)'.

xLINK: error: Unresolved external symbol '_HB_FUN_PQEXEC referenced from (t.obj)'.

Re: postgres

Posted: Fri Apr 05, 2019 10:35 pm
by nageswaragunupudi
Please see my posts above.

You need to link "pgsql.lib".
If this is not available, you need to build it using xhabour.com's compiler from the contrib sources.
I hope the paid xharbour.com provides the sources.
If not, download the sources from free xharbour and build the library.