1. damian jimenez
  2. PowerServer
  3. Tuesday, 27 December 2022 16:05 PM UTC

Hi 

Recently migrated to Powerserver 2022 build 1878, works wonders, now I'm ironing out some rough edges that appear ;)


The program in C/S delays but does not display any messages, but from Powerserver several database connection error windows appear and finally it brings the data.

When doing in a dw_1.retrieve(), from Powerserver, (a query that takes 5 seconds from outside of Powerbuilder); the DBerror event is fired with SQLDBCode=-1, showing the failed to connect window.

But in the execution of the program several attempts are made before firing the final error message.

After several database connection error messages, the data is brought to the datastore and displayed correctly.

Is there a way in Powerserver to manipulate the timeout for dw_1.retrieve() before the dberror() event is fired. ?

Thanks a lot

Damian 

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 27 December 2022 16:21 PM UTC
  2. PowerServer
  3. # 1

Hi Damien;

  The -1 return code only says that there was an error. The real problem would be defined in the DBErrText & DBErrCode return values. Also, this issue should be detailed in the PS logs.

Regards... Chris 

Comment
  1. damian jimenez
  2. Monday, 2 January 2023 12:47 PM UTC
I am going to reformulate the question since I have found a partial solution.

The app is working fine and works great.



In certain Datawindows, it is created at runtime the fields, properties, and others are injected dynamically, (sql text is asigned in sqlpreview() event ). When performing the retrieve(), the dberror() event returns the following error message:

(-1) "Select Error: Failed to create the datastore." But, after several retries, the data is brought to the datawindow and displays it correctly



To work around this wrap all dberror() event handling inside the following if:

if not (ispowerserverapp() and SQLErrText="Select Error: Failed to create the datastore") then

......[powerscript commands]....

end if

and the problem was solved in powerserver (in C/S it doesn't give problems).



I calculate that by solving this temporary error, I may avoid control of another possible error of the same nature.

Is there a better way to handle this error?



I attach log file that is generated in:

c:\inetpub\wwwroot\webapi\logging\logs\powerserver.log

when performing the retrieve()



Thanks a lot



********************************************************************************************************************************************

c:\inetpub\wwwroot\webapi\logging\logs\powerserver.log

*******************************************************************************************************************************************

2023-01-02 09:33:26,530 ERROR PowerServer. [0] - MESSAGE: Transaction is rollbacked. please call Commit()/Rollback() on DataContext after BeginTransaction(). at SnapObjects.Data.DataContext.Dispose()

at   .Dispose()

at   .()

at   ..MoveNext()

--- End of stack trace from previous location ---

at   ..MoveNext()

--- End of stack trace from previous location ---

at   ..MoveNext()

2023-01-02 09:33:26,533 ERROR PowerServer.Api.ServerApiController.OnActionExecuted [0] - MESSAGE: 'PowerServer.Api.ServerApiController.CommitAndCreateTransaction (PowerServer.Api)' get result (

{

"IsSuccess": false,

"RequestId": null,

"AppName": "CGesem",

"NameSpace": "CGesem",

"ErrorCode": 0,

"ErrorMessage": "Transaction is rollbacked. please call Commit()/Rollback() on DataContext after BeginTransaction()."

}).

2023-01-02 09:33:26,540 ERROR PowerServer. [0] - MESSAGE: Failed to commit because there is no available database connection or transaction at   ..MoveNext()

--- End of stack trace from previous location ---

at   ..MoveNext()

--- End of stack trace from previous location ---

at   ..MoveNext()

2023-01-02 09:33:26,542 ERROR PowerServer.Api.ServerApiController.OnActionExecuted [0] - MESSAGE: 'PowerServer.Api.ServerApiController.CommitAndCreateTransaction (PowerServer.Api)' get result (

{

"IsSuccess": false,

"RequestId": null,

"AppName": "CGesem",

"NameSpace": "CGesem",

"ErrorCode": 0,

"ErrorMessage": "Failed to commit because there is no available database connection or transaction"

}).

2023-01-02 09:33:26,560 ERROR PowerServer. [0] - MESSAGE: Failed to commit because there is no available database connection or transaction at   ..MoveNext()

--- End of stack trace from previous location ---

at   ..MoveNext()

--- End of stack trace from previous location ---

at   ..MoveNext()

2023-01-02 09:33:26,562 ERROR PowerServer.Api.ServerApiController.OnActionExecuted [0] - MESSAGE: 'PowerServer.Api.ServerApiController.CommitAndCreateTransaction (PowerServer.Api)' get result (

{

"IsSuccess": false,

"RequestId": null,

"AppName": "CGesem",

"NameSpace": "CGesem",

"ErrorCode": 0,

"ErrorMessage": "Failed to commit because there is no available database connection or transaction"

}).

2023-01-02 09:33:26,569 ERROR PowerServer. [0] - MESSAGE: Failed to commit because there is no available database connection or transaction at   ..MoveNext()

--- End of stack trace from previous location ---

at   ..MoveNext()

--- End of stack trace from previous location ---

at   ..MoveNext()

2023-01-02 09:33:26,571 ERROR PowerServer.Api.ServerApiController.OnActionExecuted [0] - MESSAGE: 'PowerServer.Api.ServerApiController.CommitAndCreateTransaction (PowerServer.Api)' get result (

{

"IsSuccess": false,

"RequestId": null,

"AppName": "CGesem",

"NameSpace": "CGesem",

"ErrorCode": 0,

"ErrorMessage": "Failed to commit because there is no available database connection or transaction"

}).

2023-01-02 09:33:26,583 ERROR PowerServer. [0] - MESSAGE: Failed to commit because there is no available database connection or transaction at   ..MoveNext()

--- End of stack trace from previous location ---

at   ..MoveNext()

--- End of stack trace from previous location ---

at   ..MoveNext()

2023-01-02 09:33:26,585 ERROR PowerServer.Api.ServerApiController.OnActionExecuted [0] - MESSAGE: 'PowerServer.Api.ServerApiController.CommitAndCreateTransaction (PowerServer.Api)' get result (

{

"IsSuccess": false,

"RequestId": null,

"AppName": "CGesem",

"NameSpace": "CGesem",

"ErrorCode": 0,

"ErrorMessage": "Failed to commit because there is no available database connection or transaction"

}).

2023-01-02 09:33:26,592 ERROR PowerServer. [0] - MESSAGE: Failed to commit because there is no available database connection or transaction at   ..MoveNext()

--- End of stack trace from previous location ---

at   ..MoveNext()

--- End of stack trace from previous location ---

at   ..MoveNext()

2023-01-02 09:33:26,594 ERROR PowerServer.Api.ServerApiController.OnActionExecuted [0] - MESSAGE: 'PowerServer.Api.ServerApiController.CommitAndCreateTransaction (PowerServer.Api)' get result (

{

"IsSuccess": false,

"RequestId": null,

"AppName": "CGesem",

"NameSpace": "CGesem",

"ErrorCode": 0,

"ErrorMessage": "Failed to commit because there is no available database connection or transaction"

}).

  1. Helpful
  1. Armeen Mazda @Appeon
  2. Monday, 2 January 2023 16:58 PM UTC
SQLPreview has unsupported features. Anytime something not working correctly but in client/server it works, you should first verify that it is not an unsupported feature because usually that is the problem. Here is the unsupported features guide: https://docs.appeon.com/ps2022/unsupported_features_guide.html
  1. Helpful 1
  1. Chris Pollach @Appeon
  2. Tuesday, 3 January 2023 15:23 PM UTC
In addition to Armeen's comment ... note that Engineering is planning to support the SQLPreview Event in PB 2022 "revision #2" for PS Apps.
  1. Helpful 1
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.