Page 1 of 1

FiveDBU ODBC and PostgreSQL

PostPosted: Mon Jun 26, 2023 8:54 pm
by Jimmy
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:
Image
what i´m doing wrong :?:

Re: FiveDBU ODBC and PostgreSQL

PostPosted: Mon Jun 26, 2023 9:23 pm
by nageswaragunupudi
You installed ODBC driver.
Not OLEDB provider.

Re: FiveDBU ODBC and PostgreSQL

PostPosted: Mon Jun 26, 2023 10:54 pm
by Jimmy
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 :?:

Re: FiveDBU ODBC and PostgreSQL

PostPosted: Tue Jun 27, 2023 12:29 am
by Jimmy
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 :?:

Re: FiveDBU ODBC and PostgreSQL

PostPosted: Tue Jun 27, 2023 12:46 pm
by nageswaragunupudi
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: Select all  Expand view
#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.

Image

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

Re: FiveDBU ODBC and PostgreSQL

PostPosted: Tue Jun 27, 2023 1:36 pm
by nageswaragunupudi
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: Select all  Expand view
  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.

Re: FiveDBU ODBC and PostgreSQL

PostPosted: Tue Jun 27, 2023 3:41 pm
by Jimmy
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 :?:

Re: FiveDBU ODBC and PostgreSQL

PostPosted: Wed Jun 28, 2023 8:08 pm
by nageswaragunupudi
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".
.

Re: FiveDBU ODBC and PostgreSQL

PostPosted: Wed Jun 28, 2023 8:10 pm
by nageswaragunupudi
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.