RE: Connection.setCatalog() - Mailing list pgsql-jdbc

From Peter Eisentraut
Subject RE: Connection.setCatalog()
Date
Msg-id Pine.LNX.4.30.0107162209540.680-100000@peter.localdomain
Whole thread Raw
In response to RE: Connection.setCatalog()  (jason@netspade.com)
List pgsql-jdbc
jason@netspade.com writes:

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

This seems like a reasonable interpretation.  Given that the alternative
would be to not implement it at all, I would agree if you'd implement it
as suggested.

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

Do you mean that DatabaseMetaData.getTables() in a catalog other than the
current one should reset the connection to the new catalog?  That sounds a
bit too revolutionary to me, but then again, as above, the alternative is
to not allow it at all.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


pgsql-jdbc by date:

Previous
From: Jörg Sommer
Date:
Subject: Methode is not yet implemented.
Next
From: jason@netspade.com
Date:
Subject: RE: Connection.setCatalog()