Re: Specifying connection URL at runtime?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Feb 12 2008 - 09:58:54 EST

  • Next message: Andrus Adamchik: "Runtime relationships leak into CayenneModeler"

    I guess the official way to customize how connections are made is via
    a user-provided DataSourceFactory [1]. The class name implementing
    factory interface can be entered in the Modeler for the DataNode in
    the "DataSource Factory" field. "getDataSource" method may return a
    lazy DataSource decorator that would pops up a dialog window on the
    first attempt to obtain a connection.

    [1] http://cayenne.apache.org/doc/api/org/apache/cayenne/conf/DataSourceFactory.html

    Hope this helps.
    Andrus

    On Feb 12, 2008, at 9:38 AM, Michael Gentry wrote:

    > http://cayenne.apache.org/doc/deployment.html
    >
    > And look at section 3 there, Customizing Configuration. That should
    > help. If not, let us know.
    >
    > /dev/mrg
    >
    >
    > On Feb 12, 2008 9:31 AM, Colin Bankier <colinbankie..otmail.com>
    > wrote:
    >>
    >> Hi,
    >> I'm new to cayenne, and am hoping it will prove to be the silver
    >> bullet I've
    >> been waiting for after much frustration with TopLink, Hibernate and
    >> the
    >> like!
    >>
    >> I'd like to know how I can specify the location of my database (ie
    >> the
    >> connection URL) at runtime in code rather than in the driver.xml
    >> file.
    >> This is because this is to be used in a desktop app using embedded
    >> derby
    >> where the location of the database will vary across different
    >> installations.
    >> I would also, for example, need to be able to allow the user to
    >> browse for
    >> the database location, then use that path to open a connection to the
    >> database.
    >>
    >> Any help would be greatly appreciated!
    >> Cheers,
    >> Colin Bankier.
    >> --
    >> View this message in context: http://www.nabble.com/Specifying-connection-URL-at-runtime--tp15434080p15434080.html
    >> Sent from the Cayenne - User mailing list archive at Nabble.com.
    >>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Tue Feb 12 2008 - 09:59:27 EST