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

RE: Connection.setCatalog()

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: <jason(at)netspade(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: RE: Connection.setCatalog()
Date: 2001-07-13 16:42:12
Message-ID: Pine.LNX.4.30.0107131835350.677-100000@peter.localdomain (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
jason(at)netspade(dot)com writes:

> 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

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

Peter Eisentraut   peter_e(at)gmx(dot)net

In response to

pgsql-jdbc by date

Next:From: Barry LindDate: 2001-07-13 16:44:58
Subject: Re: Not yet implemented?
Previous:From: Peter EisentrautDate: 2001-07-13 16:30:58
Subject: Re: Not yet implemented?

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