Subject | Re: Firebird database switch in same connection |
---|---|
Author | p_kenzie |
Post date | 2004-10-01T08:27:19Z |
Hi ,
The reason for using the same connection for "switching" the DBs is
to avoid too many Connections to the server. DBs like MySQL, Oracle
have provisions to switch the DBs like this (and also carry-over
transactions) at runtime. For example the MySQL has the catalog
support and the Oracle has a "Alter session.." support. This way, we
will be able to avoid many I/O connections and at the same time work
with multiple DBs in the same database server. To sum it up, its
purely for optimization purposes. It'll be good if Firebird too offers
such a support, otherwise, we need to go for connection/DB approach only.
In our application we will have many database in single db sever.
Depending upon request we will switch database,
Thanks,
Peter Kenzie
--- In Firebird-Java@yahoogroups.com, "Roman Rokytskyy"
<rrokytskyy@a...> wrote:
The reason for using the same connection for "switching" the DBs is
to avoid too many Connections to the server. DBs like MySQL, Oracle
have provisions to switch the DBs like this (and also carry-over
transactions) at runtime. For example the MySQL has the catalog
support and the Oracle has a "Alter session.." support. This way, we
will be able to avoid many I/O connections and at the same time work
with multiple DBs in the same database server. To sum it up, its
purely for optimization purposes. It'll be good if Firebird too offers
such a support, otherwise, we need to go for connection/DB approach only.
In our application we will have many database in single db sever.
Depending upon request we will switch database,
Thanks,
Peter Kenzie
--- In Firebird-Java@yahoogroups.com, "Roman Rokytskyy"
<rrokytskyy@a...> wrote:
> Hi,switch the
>
> > I have got a DB connection to the Firebird server (super sever) ,
> > to the database say 'c:\temp\one.fdb'. Now I like to switch the
> > database to 'c:\temp\two.fdb' in the same connection ..
>
> This is not possible. Connection is obtained to the database, not to the
> server. Transactions are database-bound, not server-bound.
>
> > I tried like as in the below code snippet ,
>
> > Connection conn = fb.getConnection("c:\temp\one.fdb");
> > //do some operation
> > //commit
> > //then swith db
> > conn.setCatalog("c:/temp/two.fdb");
> > // I am not sure of catalog setting will work
>
> > but db switching like above failed
>
> Catalogs are not supported by Firebird (see DatabaseMetaData results).
>
> > So kindly let me know anyway to satisfy my requirement.
>
> Please describe your requirement in details. Why do you need to
> database in the same connection? Why wouldn't be enough to use another
> connection?
>
> Roman