pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steve Wampler <swampler@noao.edu>
To: postgres-interfaces <pgsql-interfaces@postgresql.org>
Subject: Detecting presence of database through JDBC?
Date: Tue, 16 May 2000 11:19:34 -0700
Message-ID: <39219136.FC6A1C87@noao.edu> (raw)


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@noao.edu



view thread (2+ messages)  latest in thread

Message-ID: <39219136.FC6A1C87@noao.edu>
Permalink:  ../39219136.FC6A1C87@noao.edu/
Also on:    postgresql.org/message-id/39219136.FC6A1C87@noao.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: swampler@noao.edu
  Subject: Re: Detecting presence of database through JDBC?
  In-Reply-To: <39219136.FC6A1C87@noao.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox