Re: [INTERFACES] a few additional JDBC points?? - Mailing list pgsql-interfaces

From Peter Mount
Subject Re: [INTERFACES] a few additional JDBC points??
Date
Msg-id Pine.LNX.4.10.9908171223020.25445-100000@maidast.retep.org.uk
Whole thread Raw
In response to a few additional JDBC points??  (Mark Dzmura <mdz@phalanx.phalanx.net>)
List 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@retep.org.uk     Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgresJava PDF Generator: http://www.retep.org.uk/pdf



pgsql-interfaces by date:

Previous
From: "D'Arcy" "J.M." Cain
Date:
Subject: Re: [INTERFACES] A few more JDBC meta-data questions...
Next
From: "Ansley, Michael"
Date:
Subject: RE: [INTERFACES] A few more JDBC meta-data questions...