Detecting presence of database through JDBC?

From: Steve Wampler <swampler(at)noao(dot)edu>
To: postgres-interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Detecting presence of database through JDBC?
Date: 2000-05-16 18:19:34
Message-ID: 39219136.FC6A1C87@noao.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces


Is there a way to determine whether or not a particular database
exists programmatically throught JDBC? I was expecting an
exception to be thrown if the DriverManager.getConnection(url, user, pwd)
method cannot complete, but instead I get a "FATAL" error that
doesn't seem to be catchable.

(I'd like the program to automatically create a database if it doesn't
yet exist and then populate it with the tables that are needed. Handling
the tables is easy, but I haven't found a way around the test for the
database yet...)

Thanks for any help!
Steve
--
Steve Wampler- SOLIS Project, National Solar Observatory
swampler(at)noao(dot)edu

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Peter Mount 2000-05-16 19:21:18 Re: Detecting presence of database through JDBC?
Previous Message Tom Lane 2000-05-16 15:11:40 Re: libpq++ tracing considered harmful (was Re: libpq++ memory problems)