pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
a few additional JDBC points??
4+ messages / 3 participants
[nested] [flat]

* a few additional JDBC points??
@ 1999-08-16 20:49  Mark Dzmura <mdz@phalanx.phalanx.net>
  0 siblings, 1 reply; 4+ messages in thread

From: Mark Dzmura @ 1999-08-16 20:49 UTC (permalink / raw)
  To: pgsql-interfaces

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??

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

Thanks,
Mark Dzmura

--
)))) This email routed via a wireless gateway!! ((((






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* RE: [INTERFACES] a few additional JDBC points??
@ 1999-08-17 07:53  Ansley, Michael <Michael.Ansley@intec.co.za>
  0 siblings, 0 replies; 4+ messages in thread

From: Ansley, Michael @ 1999-08-17 07:53 UTC (permalink / raw)
  To: 'Mark Dzmura' <mdz@phalanx.phalanx.net>; pgsql-interfaces

Why can't you connect to template1 (all (most) servers have one, right?),
and then select * from pg_database, or select * from pg_class where rel_kind
= 'r' .

>> 
>> 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??
>> 
>> 2. Is it possible to enumerate or discover the tables in a database??
>> 
>> Thanks,
>> Mark Dzmura
>> 
>> --
>> )))) This email routed via a wireless gateway!! ((((
>> 
>> 
>> 
>> 



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [INTERFACES] a few additional JDBC points??
@ 1999-08-17 11:27  Peter Mount <peter@retep.org.uk>
  parent: Mark Dzmura <mdz@phalanx.phalanx.net>
  0 siblings, 0 replies; 4+ messages in thread

From: Peter Mount @ 1999-08-17 11:27 UTC (permalink / raw)
  To: Mark Dzmura <mdz@phalanx.phalanx.net>; +Cc: 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/postgres
 Java PDF Generator: http://www.retep.org.uk/pdf




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* RE: [INTERFACES] a few additional JDBC points??
@ 1999-08-17 12:17  Ansley, Michael <Michael.Ansley@intec.co.za>
  0 siblings, 0 replies; 4+ messages in thread

From: Ansley, Michael @ 1999-08-17 12:17 UTC (permalink / raw)
  To: 'Peter Mount' <peter@retep.org.uk>; Mark Dzmura <mdz@phalanx.phalanx.net>; 'D'Arcy\" \"J.M.\" Cain' <darcy@druid.net>; +Cc: pgsql-interfaces

>> > 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.

From different message:
> using something like DAO on a Win32 platform, then you get a nice object
> hierarchy which you can use to discover the data model, but otherwise you
> are reduced to SQL.  And DAO can't give you a list of databases!!  This is

Well, it looks like the driver takes care of that too.


MikeA



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~1999-08-17 12:17 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-08-16 20:49 a few additional JDBC points?? Mark Dzmura <mdz@phalanx.phalanx.net>
1999-08-17 11:27 ` Peter Mount <peter@retep.org.uk>
1999-08-17 07:53 RE: [INTERFACES] a few additional JDBC points?? Ansley, Michael <Michael.Ansley@intec.co.za>
1999-08-17 12:17 RE: [INTERFACES] a few additional JDBC points?? Ansley, Michael <Michael.Ansley@intec.co.za>

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