a few additional JDBC points??
a few additional JDBC points??
От:
Mark Dzmura <mdz@phalanx.phalanx.net>
Дата:
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!! ((((
Re: [INTERFACES] a few additional JDBC points??
От:
Peter Mount <peter@retep.org.uk>
Дата:
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