Request : new PostgreSQL OLEDb-Provider

Request : new PostgreSQL OLEDb-Provider

Postby Jimmy » Mon Sep 11, 2023 4:17 am

hi,

i have search for FREE OLEDB-Provider for PostgreSQL and found at Sourceforge.net



it include 32 / 64 Bit Version and Source

---

i have regsvr32 PMDAPGS.dll and got this when call OdbcConnect()
Image

i can "connect" to PostgreSQL Server
Image

but there are "no Table" shown ... :(
Image


---

i have "check" FW_RDBMSName() but it seems "empty" ... hm
Code: Select all  Expand view
     c += IfNil( oCn:Properties( "DBMS Name" ) :Value, "" ) + " " + ;
                  IfNil( oCn:Properties( "Extended Properties" ) :Value, "" )
      CATCH
fwlog c

i "guess" Fivewin dows not "know" this Driver (String)
Code: Select all  Expand view
"Provider=PMDAPGS;Server=<server_name>;Database=<db_name>;User=<user>;Password=<password>;Port=<port>"


---

i have put DLL into
c:\Program Files\Common Files\System\Ole DB\PMDAPGS.dll
as Readme say
NOT under
c:\Program Files\Common Files\System\ado\

i have not Idea what is going wrong ... need some help please
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Request : new PostgreSQL OLEDb-Provider

Postby nageswaragunupudi » Mon Sep 11, 2023 6:19 am

I am not even able to register the dll.
Got this error.
Image
Unable to proceed
Regards

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

Re: Request : new PostgreSQL OLEDb-Provider

Postby nageswaragunupudi » Mon Sep 11, 2023 6:22 am

i have "check" FW_RDBMSName() but it seems "empty" ... hm

Do not worry at all about this function.
This is basically intended for internal usage to help the function FW_ValToSQL()
It has no effect on Opening ADO connctions, Opening RecordSets and using the recordsets in any manner we need.
Regards

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

Re: Request : new PostgreSQL OLEDb-Provider

Postby Jimmy » Mon Sep 11, 2023 8:11 am

hi,
nageswaragunupudi wrote:I am not even able to register the dll.
Got this error.
Unable to proceed

have you "RegSvr32" 32 / 64 Bit DLL "as Administrator" :?:
Image
on 64 Bit OS i have use 64 Bit DLL "only" and copy it to
c:\Program Files\Common Files\System\Ole DB\PMDAPGS.dll
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Request : new PostgreSQL OLEDb-Provider

Postby Jimmy » Mon Sep 11, 2023 8:24 am

nageswaragunupudi wrote:It has no effect on Opening ADO connctions, Opening RecordSets and using the recordsets in any manner we need.

hi,

ok ... but why "is"
Code: Select all  Expand view
  oCn:Properties( "DBMS Name" ):Value

and/or
Code: Select all  Expand view
  oCn:Properties( "Extended Properties" ):Value

Empty() ... :?:

it is "listed" when call
Code: Select all  Expand view
  oDL := CreateObject( "Datalinks" ) :PromptNew()
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Request : new PostgreSQL OLEDb-Provider

Postby nageswaragunupudi » Mon Sep 11, 2023 9:53 am

If you want to see all properties of any connection object:
Code: Select all  Expand view
oCn := FW_OpenAdoConnection( <your-connectionstring>, .t. )
if oCn == nil
   ? "Fail"
else
   XBOWSER oCn  // this shows all properties
   // other works
   oCn:Close()
endif
Regards

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

Re: Request : new PostgreSQL OLEDb-Provider

Postby Jimmy » Tue Sep 12, 2023 1:41 pm

hi

thx for Answer.

nageswaragunupudi wrote:
Code: Select all  Expand view
oCn := FW_OpenAdoConnection( <your-connectionstring>, .t. )
if oCn == nil
   ? "Fail"
else
   XBOWSER oCn  // this shows all properties
   // other works
   oCn:Close()
endif

there is a Typo in CODE
XBOWSER must be XBROWSER

---

i have use it and got this
Image
i have put all Variable into String which was wrong :roll:

this is right
Code: Select all  Expand view
  EDITVARS cServer, cDatabase, cUserName, cPassword TITLE "PMDAPGS" + " : Server login"
   oCn:Open( "Provider='PMDAPGS';Server='"+cServer+"';Database='"+cDataBase+"';User='"+cUsername+"';Password='"+cPassword+"'")

now i got to Table and can XBROWSER it :D

than i try "edit" ... but it does not work :shock:
need any Tip what i´m doing wrong :idea:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Request : new PostgreSQL OLEDb-Provider

Postby nageswaragunupudi » Tue Sep 12, 2023 2:47 pm

Can I see your code for opening ado connection and recordset?
Regards

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

Re: Request : new PostgreSQL OLEDb-Provider

Postby Jimmy » Tue Sep 12, 2023 7:41 pm

here is the CODE
Code: Select all  Expand view
PROCEDURE USE_Postgre()
LOCAL oCn     := TOleAuto() :New( "ADODB.Connection" )
LOCAL oCat    := TOleAuto() :New( "ADOX.Catalog" )
LOCAL oRs     := TOleAuto() :New( "ADODB.Recordset" )
LOCAL aTables := {}, cTable
LOCAL oError, lFalse := .F.

LOCAL cServer   := "192.168.2.118"
LOCAL cDataBase := "mdidemo"
LOCAL cUsername := "postgres"
LOCAL cPassword := "********"
LOCAL cPort := "5432"

   EDITVARS cServer, cDatabase, cUserName, cPassword TITLE "PMDAPGS" + " : Server login"

   try
      oCn:Open( "Provider='PMDAPGS';Server='"+cServer+"';Database='"+cDataBase+"';User='"+cUsername+"';Password='"+cPassword+"'") // ;Port="+cPort )

   CATCH oError
      MsgInfo( oError:Description, "open Error PostgreSQL" )
      lFalse := .T.
   END TRY

   IF EMPTY( oCn ) .OR. EMPTY( oCat ) .OR. lFalse
      RETURN
   ENDIF

   oCat:ActiveConnection := oCn
   oRs := oCn:OpenSchema( 20 )                                        // adSchemaTables

   WHILE !oRs:Eof()
      AADD( aTables, oRs:Fields:Item( "Table_Name" ) :Value )
      oRs:MoveNext()
   END

   XBROWSER aTables SELECT cTable := aTables[ oBrw:nArrayAt ]
   oRs:Close()

   oRs:CursorType := 1                                                // opendkeyset
   oRs:CursorLocation := 3                                            // local cache
   oRs:LockType := 3                                                  // lockoportunistic

   IF !EMPTY( cTable )
      try
         oRs:Open( "SELECT * FROM " + cTable, oCn )                   // Password="abc" )
      catch oError
         MsgInfo( oError:Description )
      END TRY

      XBROWSER( oRS ) FASTEDIT AUTOFIT
   ENDIF

RETURN

it work under Windows 10 32 Bit AND 64 Bit in Version 10.0.19045.3448 :)
but it crash under Windows 11 Version 10.0.22621.2283 without any *.LOG :shock:

FWH 23.07 32 Bit BCC
FWH 23.04 64 Bit MSVC
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Request : new PostgreSQL OLEDb-Provider

Postby Jimmy » Mon Sep 18, 2023 4:33 pm

hi,

as i have no "real" OLEDB Driver for PostgreSQL i try to use PMDAPGS.DLL
i can XBOWSER / XBROWSE PostgreSQL Table but "save" seems not work

have found out that PMDAPGS.dll was "identify" as "XBR" when try to "save" PostgreSQL Data
but i need
Code: Select all  Expand view
METHOD SAVE( lCheckValid, lSilent ) CLASS TDataRow
   ...
   ELSEIF ::cSrcType == "PQQ"

what do i miss ... :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Request : new PostgreSQL OLEDb-Provider

Postby nageswaragunupudi » Tue Sep 19, 2023 2:42 am

but "save" seems not work

Try inline edit.

Any valid ADO recordset is recognized as RecordSet.

To start with just use
Code: Select all  Expand view
XBROWSER oRs FASTEDIT


Try to add CursorLocation of connection object also as adUseClient.'
Regards

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

Re: Request : new PostgreSQL OLEDb-Provider

Postby Jimmy » Wed Sep 20, 2023 11:01 am

hi,

thx for Answer.

i do have already CursorLocation and FASTEDIT in Sample ...

what do you mean with "inline edit" , how :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Silvio.Falconi and 79 guests