1. Tim Moulaison
  2. PowerServer
  3. Wednesday, 22 March 2023 14:35 PM UTC

I have a PB application that I am trying to convert to PowerServer. The application uses SQL Server as the database.  The application is designed to connect to the database upon start up and will close the connection after the user logs out.  What I am seeing is that the connection to the database will drop after a certain amount of time, so when I run a query against the database I get a "Transaction not connected" error message. After the error, I see the connection to the database reconnects. I have added a LongConnection parameter to my connection string but that does not seem to resolve the issue.

Any thoughts?

Thank you.

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 5 April 2023 14:35 PM UTC
  2. PowerServer
  3. # 1

Hi Everyone;

   FWIW: I solved this issue a long time ago in my STD Framework for Appeon Mobile, Appeon Web (<= PS2022 releases)  and Client/ Server based Apps as well that all had these timeout challenges. This framework feature now also extends into the new 2021/2022 PowerClient and PowerSever "Cloud" based Apps as well. The feature that I put in place was similar to the old Distributed PB, Jaguar and EAServer feature which was known as a "heartbeat". The HB feature monitors your App's DML activity and if there is none, it "pings" the DBMS server. In the case of any PowerServer version that implements an N-Tier model, the Ping" is over to the middle tier (via a JSON request) that in turn causes DML activity between the PowerServer Web API middle tier and the target DBMS - thus negating both the IIS Session timeout, Application Pool timeout and DBMS timeout settings.  :-)

   The problem with the solutions that have been proposed in this thread  thus far is that they change the web server, DB driver and/or DBMS server timeout settings. This *might* be great for the problem App (or two) but may then cause transaction handling issues for other Apps. Not to also mention middle tier and / or DBMS problems depending on the processing needs of the other various PB App's requirements.

   The Hearbeat feature is implemented in my framework on the SQLCA ancestor and thus all transaction objects can have this feature active. You can enable, disable the HB feature or change the HB frequency for any App via its INI file. Thus, the HB needs for each App can be fine tuned to meet each individual App's transaction timeout requirements without affecting the N-tier ecosystem in general.

    The only trick to this implementation was making sure that the HB feature did not fire while any DBMS activity was in progress (ie: Active transactions in play). In that case, the HB feature does nothing and just goes back to sleep waiting for the next HB check.

     FYI: You can see the HB feature being used in the STD Framework's OrderEntry Demo App. The actual implementation is done via the "NS_SQLCA_Master" ancestor object located  in the STD_FC_BASE.pbl library.  http://chrispollach.blogspot.com/2023/03/framework.html

Food for thought ... HTH!

Regards ... Chris

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 4 April 2023 20:17 PM UTC
  2. PowerServer
  3. # 2

What driver are you using? You might have better luck with a different driver.
If all else fails, try connecting with ODBC just to see if the timeout is occurring on the database side or on the client side.

Comment
  1. Armeen Mazda @Appeon
  2. Tuesday, 4 April 2023 20:43 PM UTC
PowerServer doesn't allow you to use ODBC to connect to SQL Server. Only for client/server project you can select the driver you want to use.
  1. Helpful
  1. Olan Knight
  2. Tuesday, 4 April 2023 23:55 PM UTC
Thanks, Armeen! I learn something every day!
  1. Helpful
There are no comments made yet.
Francisco Martinez @Appeon Accepted Answer Pending Moderation
  1. Friday, 24 March 2023 21:14 PM UTC
  2. PowerServer
  3. # 3

Hi Tim,

Have you checked the Timeout settings for your project?
Please see here.

Regards,
Francisco

Comment
  1. Tim Moulaison
  2. Monday, 3 April 2023 14:29 PM UTC
I have updated the Connect Retry and Connect Timeout parameters under the Advanced tab of the Database Configuration. I do not see a Session Timeout parameter under the Advanced tab. From reading the link above, it said the default Session Timeout value is 3600 seconds. My database connection is dropping before 3 minutes,
  1. Helpful
  1. mike S
  2. Monday, 3 April 2023 15:26 PM UTC
have you checked the webapi logs?
  1. Helpful
There are no comments made yet.
Tim Moulaison Accepted Answer Pending Moderation
  1. Thursday, 23 March 2023 13:30 PM UTC
  2. PowerServer
  3. # 4

I have not enabled "Allow dynamic ..." . Users connect to the database using Windows Authentication.
I have selected Windows Authentication (Serer Credentials) and then that option becomes disabled.

Comment
  1. Armeen Mazda @Appeon
  2. Thursday, 23 March 2023 15:08 PM UTC
Try using SQL Server authentication, check the box to allow dynamic connection, modify your PowerScript to assign values to LogID/LogPass, redeploy the app, and see if it resolves your problem.
  1. Helpful 1
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 22 March 2023 19:12 PM UTC
  2. PowerServer
  3. # 5

Hi Tim;

  In the PS project for the SS connectivity Cache's "Advanced" settings, did you set the Connect Timeout and optionally, Connect Retry Count and/or any other relevant parameter to ensure that the PS => DBMS connection remains up at all times as per your App's Transaction Processing needs?

Regards ... Chris

 

Comment
  1. Tim Moulaison
  2. Monday, 3 April 2023 14:29 PM UTC
I have updated the Connect Retry and Connect Timeout parameters under the Advanced tab of the Database Configuration. Thedatabase connection is still dropping before 3 minutes,



Thank you.
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 22 March 2023 18:15 PM UTC
  2. PowerServer
  3. # 6

Did you enable the dynamic login so that each user is having their own connection to the SQL Server database using their own username/password?  

Comment
  1. Tim Moulaison
  2. Monday, 3 April 2023 14:42 PM UTC
The application is configured to have different access levels that is handled by different Domain groups with different access types and place the different users into the different groups. Users log into the application using their Domain accounts. To switch the application to use SQL Authentication would take some effort. I was able to modify the application to use SQL Authentication to test to see if the database connection would remain. The result was the same. The database connection would drop before the 3 minute mark.
  1. Helpful
There are no comments made yet.
Tim Moulaison Accepted Answer Pending Moderation
  1. Wednesday, 22 March 2023 18:08 PM UTC
  2. PowerServer
  3. # 7

The application uses both but for this test it is using a data window.  It is using SetTransObject.  I would say that within the 2 minute mark is when the connection fails.

 

 

Comment
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Wednesday, 22 March 2023 15:24 PM UTC
  2. PowerServer
  3. # 8

LongConnection should not be needed

"when I run a query" - are you using datawindow/store or embedded sql ?  are you using settrans or settransobject?

 

"after a certain amount of time"   be specific (1 minute, .5 hour, 1 hour, ...)_

is it AFTER the timeout setting?  

 

 

Comment
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.