[[[ Original Message from Peter Eisentraut <[EMAIL PROTECTED]> ]]]

> > Connection.setCatalog(String database) should connect to the specified database.
> The JDBC spec says:
> : Sets a catalog name in order to select a subspace of this Connection's
> : database in which to work. If the driver does not support catalogs, it
> : will silently ignore this request.
> Note the part about "subspace".  In PostgreSQL, the database/catalog is
> fixed when the connection is established.  On other systems you can
> probably change the database/catalog while keeping the connection.  But
> you cannot establish a new connection if the spec says that this method
> should make a selection among the objects available in the current
> connection.

What do they mean by database though? It is vague because the definitions are not 
clear, but I interpret it like this: A "catalog" equals "PostgreSQL database" which is 
a subset of the whole "database" assuming "database" in this context to mean the whole 
server. I realise that the "catalog" is fixed but this is also the case for MySQL. 
Note it doesn't say "in current connection" so no reason why you can't create a new 
one. The bottom line is that supporting them would make life easier for people like me 
writing a database admin tool.

By the way, you've already applied my suggested changes to 
DatabaseMetaData.getCatalogs() - supporting that would imply supporting 

You may want to check what other similar drivers do, but as far as I can see the only 
reason for not implementing catalog support is if you have a database (e.g. Interbase) 
where you only connect to one "catalog" which is a file location - you can't actually 
list other available catalogs.

I hope that clarifies the way I see it.

> > The DatabaseMetaData.supportsCatalogsInXXX() may need to be modified.
> These methods are all implemented correctly.
> > I'm not sure about the stuff in DatabaseMetaData.getTables() for
> > example - at the moment specifying null gets all the tables in the
> > database which the driver is currently connected to. I think this is
> > fine - but different database name patterns might be specified and
> > they may have to be implemented?
> Yup.  We'll just throw an SQLException in that case.

Yes, that isn't really a problem. But _if_ you want to support catalogs maybe you have 
to go the whole way?


Jason Davies


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to