Re: [INTERFACES] a few additional JDBC points??

From: Peter Mount <peter(at)retep(dot)org(dot)uk>
To: Mark Dzmura <mdz(at)phalanx(dot)phalanx(dot)net>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [INTERFACES] a few additional JDBC points??
Date: 1999-08-17 11:27:22
Message-ID: Pine.LNX.4.10.9908171223020.25445-100000@maidast.retep.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

On Mon, 16 Aug 1999, Mark Dzmura wrote:

> Peter,
>
> Thanks for your incisive replies to my earlier query.. I still have
> two questions. (I wouldn't ask them if I was able to find the answers
> elsewhere, but I haven't found them in the JDBC 1.2 or 2.0 specs, or
> the 2 books in my possession which give some coverage to JDBC...)
>
> >From JDBC,
>
> 1. Is it possible to enumerate or discover the databases in a running
> database??

Not using any standard JDBC method. However, you could do what psql does,
and that is connect to the template1 database (which always exists), and
then issue a query on the system tables.

> 2. Is it possible to enumerate or discover the tables in a database??

Yes. Once you have a Connection, get a DatabaseMetaData object (using
getMetaData() ), and use the getTables() method.

Peter

--
Peter T Mount peter(at)retep(dot)org(dot)uk
Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
Java PDF Generator: http://www.retep.org.uk/pdf

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Ansley, Michael 1999-08-17 11:39:54 RE: [INTERFACES] A few more JDBC meta-data questions...
Previous Message D'Arcy J.M. Cain 1999-08-17 11:19:00 Re: [INTERFACES] A few more JDBC meta-data questions...