FiveDBU ODBC and PostgreSQL

FiveDBU ODBC and PostgreSQL

Postby Jimmy » Mon Jun 26, 2023 8: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:
Image
what i´m doing wrong :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1590
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: FiveDBU ODBC and PostgreSQL

Postby nageswaragunupudi » Mon Jun 26, 2023 9:23 pm

You installed ODBC driver.
Not OLEDB provider.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10295
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FiveDBU ODBC and PostgreSQL

Postby Jimmy » 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
User avatar
Jimmy
 
Posts: 1590
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: FiveDBU ODBC and PostgreSQL

Postby Jimmy » 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
User avatar
Jimmy
 
Posts: 1590
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: FiveDBU ODBC and PostgreSQL

Postby nageswaragunupudi » 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: 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10295
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FiveDBU ODBC and PostgreSQL

Postby nageswaragunupudi » Tue Jun 27, 2023 1: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: 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10295
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FiveDBU ODBC and PostgreSQL

Postby Jimmy » Tue Jun 27, 2023 3: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
User avatar
Jimmy
 
Posts: 1590
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: FiveDBU ODBC and PostgreSQL

Postby nageswaragunupudi » Wed Jun 28, 2023 8: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
User avatar
nageswaragunupudi
 
Posts: 10295
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FiveDBU ODBC and PostgreSQL

Postby nageswaragunupudi » Wed Jun 28, 2023 8: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
User avatar
nageswaragunupudi
 
Posts: 10295
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 46 guests