Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-interfaces by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group