Create a continuous test for PostgreSQL

Gerhardpet
Gerhardpet used Ask the Experts™
on
Create a continuous test for PostgreSQL from the server to the client computer. We have an ERP using PostgreSQL database and we have random disconnects from the database/server. I know it is either network or server related but need to figure out how I could create a continuous test of some sort.

Any idea how I could troubleshoot this?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
On the client create an infinite loop from a Shell/Script on the client that selects the same values over and over across the network?

Author

Commented:
I'm not a developer. I know how to run basic queries. Are you able to help me with creating a shell/script that would do this?
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
What OS/tools/??? do you have on the client that you can use?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Windows 2012 server and the clients are a combination of Windows 7 and 10

Author

Commented:
I could install PGAdmin on the workstation if that would help to do this
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
Not sure when I'll have time to work on this and I don't have Postgres access to test anything live.

I'm thinking Powershell.  There seem to be several examples out there using ODBC to connect to a remote Postgres database.  The loop should be straight forward.

If no other Expert shows up, I'll try to get some time later this weekend to mock something up.

Author

Commented:
Sure, thank you for your help!
SharathData Engineer

Commented:
pg_isready to check the connection status of a PostgreSQL server
https://www.postgresql.org/docs/9.3/static/app-pg-isready.html

There will be plenty of example you can search.
Here is one bash script: https://starkandwayne.com/blog/how-to-know-when-your-postgres-service-is-ready/
It can be easily done in windows batch file too if you don't have linux or python/perl etc.
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
Seems like an approach that might work and with less actual code.  You'll need to reverse the script example to tell you when a connection isn't available instead of when one is.

Author

Commented:
Scripting is beyond me so reversing it is something I'm not sure how to do. Also, I like to have some kind of logging in a text file. How would I do that?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial