SET SCHEMA does apply only to the current connection.
The pooling API in the base JDK has a callback to address
the issue that
you raise. When user code requests a new connection, the
connection
pool implementation is supposed to initiate this callback to
do any
re-initialization which is needed. I had implemented this
in HSQLDB's
data pool data source, but I don't think I ever committed
it, since a
different developer had responsibility for this data source
(and he was
otherwise occupied for months). I was in no hurry to get
the data
pooling working properly because the demand for this feature
is app
servers, and every popular app server supports only their
own data pool,
one of the generic open source ones, or allegedly support
generic data
pools. Unfortunately, I tested the 6 most popular or
promising
products, and none implemented the spec properly-- so even
if you had a
correctly implemented HSQLDB data source pool, it would not
work right
with app servers. I tried to initiate communication with
the JBoss team
to get them to follow the spec, but they were uninterested.
Until this problem is resolved, I suggest that you code the
schema into
your ORM mappings. I know this causes an undesirable tight
coupling
between runtime environment and application, but the
alternative is that
connections will get a current schema of whatever the
previous
connection user happened to use. This means that with
global data
sources (most commercial servers are used this way), one app
can clobber
other apps. Example: App 1 is a prototyping app using the
JSTL JDBC
tags and runs "SET SCHEMA x". If app 1 closes a
connection and app 2
later opens a connection, app 2 will happen to have the
current schema
set to x.
Christoph Weißenborn wrote:
> Hello Fred,
>
> Thank you for your fast response!
>
> Ok, I have understood. I/we use hsql via
JDO/Spring/JDBC-Pooling. I think the SET SCHEMA has to apply
only to the current connection. Otherwise a multi user mode
is not possible. But connecting via a pool (and one user) we
have to set the schema every time because the connection can
be a newly created one... Or we have to wait for the new
release.
>
> Greets,
> Christoph
>
------------------------------------------------------------
-------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and
a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Hsqldb-user mailing list
Hsqldb-user lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
|