Loading ...
Sorry, an error occurred while loading the content.
 

Re: Firebird database switch in same connection

Expand Messages
  • p_kenzie
    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
    Message 1 of 4 , Oct 1, 2004
      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:
      > Hi,
      >
      > > 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
      switch the
      > database in the same connection? Why wouldn't be enough to use another
      > connection?
      >
      > Roman
    • Roman Rokytskyy
      Hi, ... Please post this as a fature request in the Firebird-Support or Firebird-Architect list. From my personal experience time needed to establish
      Message 2 of 4 , Oct 1, 2004
        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,

        Please post this as a fature request in the Firebird-Support or
        Firebird-Architect list.

        From my personal experience time needed to establish connection can be
        neglected compared to the time needed to compile and execute statements.
        AS3AP test suite shows only slight peformance improvement when using
        connection pooling compared to the improvement when statement caching is
        used. In case of Firebird you can rely on opening new connection to a
        database when needed, but transactions will remain database-local unless you
        use XADataSource and a distributed transaction coordinator.

        Roman
      Your message has been successfully submitted and would be delivered to recipients shortly.