Skip site navigation (1) Skip section navigation (2)

Simple DB presence verifier.

From: "Damian C" <jamianb(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Simple DB presence verifier.
Date: 2007-03-04 21:40:25
Message-ID: 2bbc8f530703041340t24caf87p4c04fd55b91a11a5@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
Hello,
This is a real novice question!  We are developing a distributed
(~1-10 PCs) Java office application that uses Postgres as the central
data store. We are capable Java developers, but our Postgres skills
are limited because it is primarily hidden behind Hibernate ORM.  Our
product is aimed at a "technically illiterate small business" market,
so there will be no fancy equipment or system administrators, and
"forgetting to turn on the server" will be a common fail case.

Our use case involves the java desktops checking to see if Postgres is
available at (1) startup, and (2) ongoing "watchdog", perhaps every
minute or so.

My first attempt has been to write a query such as "SELECT last_value
FROM est_sequence". If the query fails then we can conclude that the
database is not present.

What we are looking for is a simple, low overhead, "quick succeed,
catchable fail", way to check if the database is available.

Can anyone suggest an improved technique to check for database presence??

All suggestions welcome.
Many thanks,
-Damian

Responses

pgsql-novice by date

Next:From: John DeSoiDate: 2007-03-05 13:25:08
Subject: Re: Simple DB presence verifier.
Previous:From: Frank BaxDate: 2007-03-04 21:21:24
Subject: 8.2 docs error?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group