Re: Simple DB presence verifier.
От | John DeSoi |
---|---|
Тема | Re: Simple DB presence verifier. |
Дата | |
Msg-id | 4027C48C-EBF5-456C-A3C2-5A3138A34351@pgedit.com обсуждение исходный текст |
Ответ на | Simple DB presence verifier. ("Damian C" <jamianb@gmail.com>) |
Список | pgsql-novice |
If PostgreSQL is not running you won't be able to connect to any database. When you do successfully connect, you have to specify a database. So if your connection succeeds, you have already verified the existence of the database. If the database was "missing" you would get a "database does not exist error". If Hibernate connects for you and you don't have any commands to verify the connection, a simple "SELECT 1" should work. If you are connected and need to verify the existence of a database other than the one you are connected to then something like: select count(*) from pg_database where datname = 'postgres'; John On Mar 4, 2007, at 4:40 PM, Damian C wrote: > 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?? John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL
В списке pgsql-novice по дате отправления: