FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FiveDBU ODBC and PostgreSQL
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
FiveDBU ODBC and PostgreSQL
Posted: Mon Jun 26, 2023 08:54 PM
hi,

i have installed ODBC Driver and configure in ODBC-Manager
i have press "Test" and it say ok

but when call FiveDBU it does not appear ,,, :shock:

what i´m doing wrong :?:
greeting,

Jimmy
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FiveDBU ODBC and PostgreSQL
Posted: Mon Jun 26, 2023 09:23 PM

You installed ODBC driver.

Not OLEDB provider.

Regards



G. N. Rao.

Hyderabad, India
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: FiveDBU ODBC and PostgreSQL
Posted: Mon Jun 26, 2023 10:54 PM
hi,
nageswaragunupudi wrote:You installed ODBC driver.
Not OLEDB provider.
i know but that is what FiveDBU show under ODBC :!:

or did i understood it wrong using psqlodbc_x86.msi ODBC Driver :?:
greeting,

Jimmy
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: FiveDBU ODBC and PostgreSQL
Posted: Tue Jun 27, 2023 12:29 AM
hi

found Demo c:\fwh\samples\testodbc.prg which work with ODBC to open PostgreSQL Catalog / Table :D

i can "modify" Data but it "seems" that Table is "read only" :shock:
how to modify Sample for R/W :?:
greeting,

Jimmy
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FiveDBU ODBC and PostgreSQL
Posted: Tue Jun 27, 2023 12:46 PM
I haven't worked with PostGre recently.
I have PostGre server along with PostGre OLEDB Provider installed on my PC some years back.
Now, I tested using our ADO functions and it is working well.

My Server Version:
PostgreSQL 10.7, compiled by Visual C++ build 1800, 32-bit
This is my test code:
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oCn

   oCn   := FW_OpenAdoConnection( "POSTGRE,localhost,postgres,postgres,India@1947", .t. )
   if oCn == nil
      ? "failed to connect"
   else
      ? "connected"
      XBROWSER FW_AdoTables( oCn ) SETUP ( ;
         oBrw:aCols[ 1 ]:bLDClickData := ;
         { |r,c,f,o| BrowseAdoTable( oCn, o:Value ) } )
      oCn:Close()
   endif

return nil

static function BrowseAdoTable( oCn, cTable )

   local oRs   := FW_OpenTRecSet( oCn, "select * from " + cTable )

   XBROWSER oRs TITLE cTable FASTEDIT
   oRs:Close()

return nil
Note: This XBROWSER command works with your FWH2206 also.



I will soon download and install ODBC driver and test with it.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FiveDBU ODBC and PostgreSQL
Posted: Tue Jun 27, 2023 01:36 PM
I found ODBC driver (32-bit) also was installed along with server and oledb driver.

This is how I connected changing the few lines in the above sample.
Code (fw): Select all Collapse
   local cStr  := "Provider=MSDASQL;Driver={PostgreSQL ODBC Driver(UNICODE)};Server=localhost;Port=5432;Database=postgres;Uid=postgres;Pwd=India@1947;"

   oCn   := FW_OpenAdoConnection( cStr, .t. )
Now the above program connects using ODBC and works exactly the same way as above.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: FiveDBU ODBC and PostgreSQL
Posted: Tue Jun 27, 2023 03:41 PM
hi,

thx for Answer

OLEDB for PostgreSQL is not free any more so i can´t test it
can you provide "old" Version of OLEDB Driver for PostgreSQL :?:

your ODBC Driver begin with "Provider" but psqlODBC Driver begin with "Driver"
Question : is Button ODBC in FiveDBU for OLEDB or ODBC :?:
greeting,

Jimmy
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FiveDBU ODBC and PostgreSQL
Posted: Wed Jun 28, 2023 08:08 PM
your ODBC Driver begin with "Provider" but psqlODBC Driver begin with "Driver"
Micorsoft provides a Provider "MADASQL" for using ODBC drivers with ADO.

If we want to use an ODBC driver with ADO, we SHOULD prefix "Provider=MADASQL;" before the "Driver={any odbc driver};"

Please read the connection string again.

This is done with full knowledge and we posted the connection string only after testing.

Looks like you did not test and rejected it just because it starts with "Provider".
.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FiveDBU ODBC and PostgreSQL
Posted: Wed Jun 28, 2023 08:10 PM
Question : is Button ODBC in FiveDBU for OLEDB or ODBC :?:
You are right. Button ODBC displays a list of OLEDB providers instead of list of ODBC DSNs.
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion