Re: Multiple Database

From: Sami Mohammed (SMOHAMME..ndependenthealth.com)
Date: Tue Apr 26 2005 - 17:56:52 EDT

  • Next message: Dhruti Ramani: "Re: Comparing two Dates in cayenne"

    Hi Mike
    I am using multiple databases at the same time in single application.

    i am creating multiple dataNodes under one domain name (STESTMultipleDataBase)

    with different DataMaps (map location ="STESTOracleMap.map.xml", map name ="STESTMapSqlserver.map.xml" ),

    and differnet DataNodes (STESTOracleNode,"STESTSqlServerNode)

    is it correct to create muliple DataMaps under one domain name with muliple DataNodes ?

    see my cayenne file below

    <?xml version="1.0" encoding="utf-8"?>
    <domains project-version="1.1">
    <domain name="STESTMultipleDataBase">
            <map name="STESTOracleMap" location="STESTOracleMap.map.xml"/>
            <map name="STESTMapSqlserver" location="STESTMapSqlserver.map.xml"/>

            <node name="STESTOracleNode"
                     datasource="jdbc/EDWDORACLE"
                     adapter="org.objectstyle.cayenne.dba.oracle.OracleAdapter"
                     factory="org.objectstyle.cayenne.conf.JNDIDataSourceFactory">
                            <map-ref name="STESTOracleMap"/>
             </node>
            <node name="STESTSqlServerNode"
                     datasource="jdbc/EDWDSQLSERVER"
                     adapter="org.objectstyle.cayenne.dba.sqlserver.SQLServerAdapter"
                     factory="org.objectstyle.cayenne.conf.JNDIDataSourceFactory">
                            <map-ref name="STESTMapSqlserver"/>
             </node>
    </domain>
    </domains>

    Thanks
    sami

    CONFIDENTIALITY NOTICE. This e-mail and attachments, if any, may contain confidential information which is privileged and protected from disclosure by Federal and State
    confidentiality laws rules and regulations. This e-mail and attachments, if any, are intended for the designated addressee only. If you are not the designated addressee, you
    are hereby notified that any disclosure, copying, or distribution of this e-mail and its attachments, if any, may be unlawful and may subject you to legal consequences. If you
    have received this e-mail and attachments in error, please contact Independent Health immediately at (716) 631-3001 and delete the e-mail and its attachments from your
    computer. Thank you for your attention

    >>> mkienen..laska.net 04/26/05 05:01PM >>>
    Sami Mohammed <SMOHAMME..ndependenthealth.com> wrote:
    > In my web application, i want to use different databases like oracle,
    sqlserve and DB2, is it possible with same domanin name or i have to create
    differnt doman name in the cayenne.xml or i have to create different
    dataNodes and DataMap files for each database.

    If you want to use different databases, but only one at any particular time,
    you can just specify which <driver>.xml file you want in order to choose the
    database. I do this all the time, changing only my driver.xml file when
    running unit tests, or development tests, or production tests.

    If you want to use multiple databases at the same time, I think you can
    reuse the DataMap, but you need to create a DataDomain/DataNode for each
    database, and they'd all point to the same DataMap. However, I've never
    done this, so I could be wrong.

    -Mike



    This archive was generated by hypermail 2.0.0 : Tue Apr 26 2005 - 17:57:09 EDT