Re: DbVisualizer shows same tables for all DBs - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: DbVisualizer shows same tables for all DBs
Date
Msg-id Pine.LNX.4.33.0301281657260.2639-100000@leary.csoft.net
Whole thread Raw
In response to DbVisualizer shows same tables for all DBs  (Daniel Serodio <daniel@checkforte.com.br>)
Responses Re: DbVisualizer shows same tables for all DBs
Re: DbVisualizer shows same tables for all DBs
List pgsql-jdbc

On 28 Jan 2003, Daniel Serodio wrote:

> I know Postgresql doesn't allow changing DBs with the same Connection,
> but it should let tools know about this limitation via DatabaseMetadata.
> I'm not particularly familiar with the JDBC spec, so I don't know if the
> driver doesn't implement the spec correctly or if the spec doesn't cover
> this sutiation.
>
> The fact is, when I connect to a Postgresql DB using DbVisualizer Free
> 3.1 (www.minq.se) and latest JDBC driver (build 106), I specify which DB
> I want to connect to in the connection URL (ie
> "jdbc:postgresql://localhost:5432/testdb"), and 3 DBs show up: testdb,
> template0 and template1. The weird thing is that template0 and template1
> seem to be exact copies of testdb. AFAIK, what's really happening is
> that the driver can't "see" other DBs besides the one I connected to
> (testdb), so it shows all DBs as if they were the same. IMHO, this
> behaviour is quite confusing.

The DatabaseMetaData.getCatalogs() method is called by DbVisualizer to get
the list of available databases.  When trying to display the tables in the
database it passes the desired catalog name into the getTables method, but
it is ignored.

What could be done:

1) Make getCatalogs() only return the current catalog.

2) Make other DatabaseMetaData methods throw an SQLException if a catalog
other than Connection.getCatalog() is used.

The getCatalogs() method's javadoc says "Gets the catalog names available
in this database."  Does that mean are available to this connection or to
the current user on another connection or another user on another
connection?

Kris Jurka



pgsql-jdbc by date:

Previous
From: Daniel Serodio
Date:
Subject: DbVisualizer shows same tables for all DBs
Next
From: "Renaud Waldura"
Date:
Subject: Re: Requiring Ant 1.5 for build breaks JDK 1.1 compatibility