Page 1 of 2

Error connecting with PGDBE

Posted: Tue Apr 07, 2020 6:36 am
by bamunz@earthlink.net
I am getting an error on SqlQuery trying to connect with PGDBE. I am connecting fine with my program using:
cConnStr := "DBE=pgdbe;server=MAIN;db=MUNZ;uid=postgres;pwd=..."
DbeLoad("pgdbe")
dbeSetDefault("pgdbe")
oSession := DacSession():New(cConnStr)

but have tried both the following ini entries:

[PG_1]
Name=MUNZ (PostGreSql)
ConnectString=
ServerDict=Main
Database=MUNZ
UID=postgres
PWD=...

[PG_2]
Type=PG
Name=Munz2
Driver=
Server=localhost
Database=MUNZ
UID=postgres
PWD=...
ConnectTimeOut=0

For some reason it won't let me attach error log

FATAL ERROR LOG
No continue after this Error!
SYS Thread-ID: 2700
Module: EXE
Error Codes: EH: 10 Sub: 0(0) OS: 0 XPP: 0
Call Stack of Thread 1 (1208):
@DC_GETLIST@I@EVENTLOOP(4265)
@DC_GETLIST@I@READGUI(3970)
DC_READGUI(113)
@SQLQUERY@I@SHOWDIALOG(1361)
MAIN(190)
Call Stack of GUI Thread (1380):
Call Stack of Thread 4 (2700):
@SQLQUERYCONNECTION@I@CONNECTPG(13347)
@SQLQUERYCONNECTION@I@CONNECT(13085)
@SQLQUERY@I@BUILDTREEBRANCH(3200)
(B)@SQLQUERY@I@TREEWINDOW(1417)
(B)_TreeItemBlock(6250)
@DC_GETLIST@I@EVENTLOOP(4798)
@DC_GETLIST@I@READGUI(3970)
DC_READGUI(113)
@SQLQUERY@I@TREEWINDOW(1453)
(B)_ResizeTree(1388)
_GUIRUN(6925)
(B)GuiRun(6912)
File: C:\SqlQuery20\SQLQUERY.EXE
TimeStamp: 20200406 16:22
End of FATAL ERROR LOG.

Re: Error connecting with PGDBE

Posted: Tue Apr 07, 2020 8:16 am
by rdonnay
What version of SqlQuery are you using? Most current version is 2.0.159. Click on Help - About Sqlquery

I need to see if SqlQuery is building the connect string correctly.

If you are using SqlQuery then you should have the source: SQLQUERY.PRG.

Look at the method named METHOD SqlQueryConnection:ConnectPg(oSqlQuery)

This should start at about line 13529 (build 2.0.159)

Add a debug statement at line 13555 to view the value of cSqlConnect before it is passed to DC_DacSession().

WTF cSqlConnect

Run PBUILD SQLQUERY to rebuild SQLQUERY.DLL

Run the program and try to connect again.

The connect string in the debug window should look the same as that used in your application.

Re: Error connecting with PGDBE

Posted: Tue Apr 07, 2020 8:29 am
by bamunz@earthlink.net
I am on 2.0.158 and when I go to help and Download Latest Version it says it is latest version.
Where do I get 2.0.159?

Re: Error connecting with PGDBE

Posted: Tue Apr 07, 2020 8:56 am
by rdonnay
You can also do this with 258. 259 was the lastest build added to eXpress++.

Look for the method I referenced and add the debugging.

Re: Error connecting with PGDBE

Posted: Tue Apr 07, 2020 11:01 am
by bamunz@earthlink.net
The error is in loading the DBE in SqlQueryConnection:ConnectPg

IF !('PGDBE'$aDbeList) .AND. !DbeLoad( "PGDBE",.f.)
DC_WinAlert('Database-Engine PGDBE not loaded')
RETURN .f.
ENDIF

Re: Error connecting with PGDBE

Posted: Tue Apr 07, 2020 11:36 am
by rdonnay
I am guessing that you don't have PGDBE.DLL in the path where you are running SqlQuery.exe

Re: Error connecting with PGDBE

Posted: Tue Apr 07, 2020 1:36 pm
by bamunz@earthlink.net
It was in the SqlQuery20 folder with exe but not in path.

Thanks

Error on Multi-table Select

Posted: Tue Apr 07, 2020 2:47 pm
by bamunz@earthlink.net
I posted following message on The Alaska Forum last week and have also run the SQL with SqlQuery successfully.


I have been testing with Postgres with the PGDBE and this is first
multi-table select I have tried.

cSQL = "SELECT loan.*, customer.l_name, customer.f_name, customer.mi,
customer.generation, customer.paddress, customer.city, customer.state,
customer.zip, customer.hm_phone, customer.wk_phone, customer.cell FROM loan,
customer WHERE customer.contr_no > 0 AND customer.contr_no = loan.contr_no"
oStmt := DacSqlStatement():fromChar(cSQL)
oStmt:build():execute()

I get the following error:

oError:args : -> VALTYPE: U VALUE: NIL
oError:canDefault : Y
oError:canRetry : N
oError:canSubstitute: Y
oError:cargo : {NIL, -1, D}
oError:description : D
oError:filename :
oError:genCode : 9001
oError:operation : ABSTRACTSQLSTATEMENTBUILDER:EXECUTESTATEMENT
oError:osCode : 0
oError:severity : 2
oError:subCode : -1
oError:subSystem : Remote SQL dacSession


I can copy and paste that select string in PGAdmin and it returns results
without a problem.

Re: Error connecting with PGDBE

Posted: Tue Apr 07, 2020 4:01 pm
by rdonnay
Are you saying that this statement runs ok under SqlQuery but not in your application?

Re: Error connecting with PGDBE

Posted: Wed Apr 08, 2020 7:40 am
by bamunz@earthlink.net
Yes it works with SqlQuery and pgadmin but that command I posted errors out.