Re: Connection.setCatalog()

Поиск
Список
Период
Сортировка
От jason@netspade.com
Тема Re: Connection.setCatalog()
Дата
Msg-id 5311068.995750385394.JavaMail.jason@www2.kc.aoindustries.com
обсуждение исходный текст
Ответ на Connection.setCatalog()  (jason@netspade.com)
Список pgsql-jdbc
[[[ Original Message from Barry Lind <blind@xythos.com> ]]]

>
> I don't like this patch.  Nothing wrong with the code, but with what is
> being done.  I wouldn't expect the setCatalog method to end my current
> transaction and quietly reconect me to another database.  In this new
> connection my auto comit status will be reset and there could be other
> side effects I haven't yet thought of.  What happens if the current user
> doesn't have permission to connect to the new database?

It's the only way at the moment until catalogs are sorted out properly. If the current user doesn't have permission to
connectto the new database an SQLException will be thrown. I don't have any experience with auto commit stuff but if
youdon't want it to be reset then simply don't use setCatalog. 

> Also are there any security issues with having a client being able to
> discover all databases and then going and listing all tables/objects in
> them?

Well, that doesn't depend on the driver implementation.

> If we can't come up with a secure way of querying this information
> without reconnecting the connection, then I think we should not
> implement setCatalog.

Basically it just imitates the \c command in the pgsql command line interface. Ideally there should be a way to
continueusing the current connection, like the USE command in MySQL. BTW, this is how the mm.mysql driver implements
setCatalog()- it just calls "USE catalogname". 

> BTW Does anyone know what the Oracle driver does with catalogs, since
> they also don't have such a concept natively.  I am especially
> interested in if they support Connection.setCatalog().

AFAIK Oracle doesn't support any of the catalogs stuff at all and Connection.setCatalog() is ignored.


Jason Davies

jason@netspade.com

> --Barry
>
> jason@netspade.com wrote:
>
> > Date: Thu, 19 Jul 2001 14:48:45 -0500
> > From: jason@netspade.com
> > To: Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>
> > Subject: Re: Connection.setCatalog()
> >
> > [[[ Original Message from Tom Lane <tgl@sss.pgh.pa.us> ]]]
> >
> >> Peter Eisentraut <peter_e@gmx.net> writes:
> >> > Tom Lane writes:
> >> >> Peter E. has previously commented that Postgres databases correspond
> >> >> most closely to the SQL concept of "catalog cluster", not "catalog".
> >>
> >> > I most certainly did not.  According to my interpretation:
> >>
> >> I sit corrected.  If you want to define catalog == database, okay with
> >> me.
> >>
> >>             regards, tom lane
> >
> > Great, here is a context diff of CVS for implementing the
> > get/setCatalog methods in Connection - note: I've updated
> > setCatalog(String catalog) from my previous diff so it checks whether
> > it is already connected to the specified catalog.
> >
> > Thanks,
> >
> > Jason Davies
> >
> > jason@netspade.com
> > [Connection.diff]
> > [attachment omitted]
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/users-lounge/docs/faq.html
>

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Anders Bengtsson
Дата:
Сообщение: Re: [PATCHES] Re: [PATCH] Cleanup of JDBC character encoding
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [PATCHES] Re: [PATCH] Cleanup of JDBC character encoding