FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour postgres
Posts: 357
Joined: Thu Nov 02, 2006 06:53 PM
postgres
Posted: Sun Mar 17, 2019 09:07 PM

if FW_OpenAdoConnection open postgres ?

best regards
KAJOT

best regards

kajot
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: postgres
Posted: Mon Mar 18, 2019 02:15 AM

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.

Regards



G. N. Rao.

Hyderabad, India
Posts: 357
Joined: Thu Nov 02, 2006 06:53 PM
Re: postgres
Posted: Tue Mar 19, 2019 11:23 AM

ask for an example , because none work

best regards

kajot
Posts: 357
Joined: Thu Nov 02, 2006 06:53 PM
Re: postgres
Posted: Tue Mar 19, 2019 11:35 AM

with MSSQL works well

best regards

kajot
Posts: 357
Joined: Thu Nov 02, 2006 06:53 PM
Re: postgres
Posted: Wed Apr 03, 2019 07:44 PM

Does anyone use Postgres ?

best regards

kajot
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: postgres
Posted: Wed Apr 03, 2019 08:17 PM

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

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: postgres
Posted: Wed Apr 03, 2019 10:44 PM
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 (fw): Select all Collapse
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.
Regards



G. N. Rao.

Hyderabad, India
Posts: 357
Joined: Thu Nov 02, 2006 06:53 PM
Re: postgres
Posted: Thu Apr 04, 2019 05:24 PM

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)'.

best regards

kajot
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: postgres
Posted: Fri Apr 05, 2019 02:36 AM

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.

Regards



G. N. Rao.

Hyderabad, India
Posts: 357
Joined: Thu Nov 02, 2006 06:53 PM
Re: postgres
Posted: Fri Apr 05, 2019 05:08 PM

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

best regards

kajot
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: postgres
Posted: Fri Apr 05, 2019 06:05 PM

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.

Regards



G. N. Rao.

Hyderabad, India
Posts: 357
Joined: Thu Nov 02, 2006 06:53 PM
Re: postgres
Posted: Fri Apr 05, 2019 09:34 PM

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'.

best regards

kajot
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: postgres
Posted: Fri Apr 05, 2019 09:54 PM

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.

Regards



G. N. Rao.

Hyderabad, India
Posts: 357
Joined: Thu Nov 02, 2006 06:53 PM
Re: postgres
Posted: Fri Apr 05, 2019 10:26 PM

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)'.

best regards

kajot
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: postgres
Posted: Fri Apr 05, 2019 10:35 PM

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.

Regards



G. N. Rao.

Hyderabad, India