Re: Switching Between Databases

From: Joe Baldwin (jfbaldwi..arthlink.net)
Date: Thu Jul 19 2007 - 03:11:40 EDT

  • Next message: Andrus Adamchik: "Re: Switching Between Databases"

    Malcolm,

    OK, you asked for an idea (this is untested):

    Java defines a DataSource interface:

            http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/sql/package-
    summary.html

    Is it possible to drill down and create a connection pool as
    described in this link and then set the desired DataSource via the
    Cayenne DataNode class during runtime?

            http://cayenne.apache.org/doc20/api/cayenne/org/apache/cayenne/
    access/DataNode.html#dataSource

    A connection-pool *sounds* like what you are describing. (Having
    said this, there is probably a more elegant connection-pool manager
    in one of the Utility classes. :) )

    Joe

    On Jul 18, 2007, at 10:23 PM, Malcolm Edgar wrote:

    > Hi All,
    >
    > what is an easy way to switch between databases in Cayenne, while
    > maintaining the same mapping file.
    >
    > We are going on the road doing demos, with different MySQL
    > databases (same
    > schema design), and want to be able to switch between them with the
    > same
    > application. Is there an way to do this is Cayenne. My concern it
    > that the
    > schema name is defined in the cayenne mapping file.
    >
    > Any ideas?
    >
    > regards Malcolm Edgar



    This archive was generated by hypermail 2.0.0 : Thu Jul 19 2007 - 03:12:18 EDT