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

From Peter Eisentraut
Subject RE: Connection.setCatalog()
Date
Msg-id Pine.LNX.4.30.0107131835350.677-100000@peter.localdomain
Whole thread Raw
In response to RE: Connection.setCatalog()  (jason@netspade.com)
List pgsql-jdbc
jason@netspade.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
connection.

> 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@gmx.net   http://funkturm.homeip.net/~peter


pgsql-jdbc by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Not yet implemented?
Next
From: Barry Lind
Date:
Subject: Re: problen in starting the naming service using the JDBC driver!