Create a continuous test for PostgreSQL

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?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) 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?
GerhardpetAuthor 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?
slightwv (䄆 Netminder) Commented:
What OS/tools/??? do you have on the client that you can use?
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

GerhardpetAuthor Commented:
Windows 2012 server and the clients are a combination of Windows 7 and 10
GerhardpetAuthor Commented:
I could install PGAdmin on the workstation if that would help to do this
slightwv (䄆 Netminder) 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.
GerhardpetAuthor Commented:
Sure, thank you for your help!
SharathData EngineerCommented:
pg_isready to check the connection status of a PostgreSQL server

There will be plenty of example you can search.
Here is one bash script:
It can be easily done in windows batch file too if you don't have linux or python/perl etc.
slightwv (䄆 Netminder) 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.
GerhardpetAuthor 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?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.