Hi Emir,

just as proposed by Bruce, whenever I want to force
Castor to reload the mapping files, I just give a
different database name for example "care4u1" and then
"care4u2" in the example below. Notice that in my
case, I do not have a database configuration file, I
construct the string on the fly like this:

String strDatabaseFileAsString = "

<databases>
    <database name="care4u1" engine="sapdb">
        <driver
class-name="com.sap.dbtech.jdbc.DriverSapDB"
                url="jdbc:sapdb://pclab/telecare">
           <param name="user" value="telecare" />
           <param name="password" value="telecare" />
        </driver>
        <mapping href="/home/Software/demo-jdo1.xml"
/>
    </database> ";

and then I load it with:

jdo.loadConfiguration(new InputSource(new
StringReader(strDatabaseFileAsString)), null, null);

Hope this will be of help.

Good luck,
wy

--- Emir Causevic <[EMAIL PROTECTED]> wrote:
> 
> 
> Hi Wlid,
> could you please send me your db config xml file
> where you have
> 2 database configured.
> I can't figure out what's problem with my
> configuration file.
> 
> Thank you and regards,
> Emir
> 
> Wlid Yemah writes:
> 
> > 
> > 
> > Hi there,
> > 
> > The suggested method number 2 does work for me.
> > 
> > Thank you!
> > wy
> > 
> > --- Bruce Snyder <[EMAIL PROTECTED]> wrote:
> >> 
> >> Emir Causevic wrote:
> >> > 
> >> > Hi Bruce,
> >> > I'm not sure if the proposed method number 2
> below
> >> is working.
> >> > Here is my configuration file content:
> >> > 
> >> > <databases> <!-- this is line 2 listed in the
> >> exception message below
> >> > -->
> >> >   <database name="SB" engine="oracle">
> >> >     <driver
> >> class-name="oracle.jdbc.driver.OracleDriver"
> >> > url="jdbc:oracle:thin:@murgle:1521:SB">
> >> >       <param name="user" value="emir" />
> >> >       <param name="password" value="emir" />
> >> >     </driver>
> >> >     <mapping href="mapping.xml"/>
> >> >  </database>
> >> > 
> >> > <!-- Configuration for SAPDB database -->
> >> >   <database name="castor" engine="sapdb">
> >> >     <driver
> >> class-name="com.sap.dbtech.jdbc.DriverSapDB"
> >> > url="jdbc:sapdb://mssql2k/castor">
> >> >       <param name="user" value="dba" />
> >> >       <param name="password" value="dba" />
> >> >       </driver>
> >> >       <mapping href="mapping.xml"/>
> >> >   </database>
> >> > </databases>
> >> > 
> >> > I'm using same test code to test Oracle and
> SAPDB
> >> connection.
> >> > Here is some java code excerpt:
> >> >     JDO jdo = new JDO();
> >> >     jdo.setDatabaseName("castor");
> >> >     // jdo.setDatabaseName("SB");
> >> >     try
> >> >     {
> >> >       jdo.loadConfiguration("database.xml");
> >> >     }
> >> >     catch(MappingException me)
> >> >     {
> >> >       System.out.println("==> Exception
> reported
> >> while loading db config
> >> > file: " + me.getMessage());
> >> >     }
> >> > 
> >> > And finally here's the output:
> >> > ==> Exception reported while loading db config
> >> file: Nested error:
> >> > org.xml.sax.SAXException: database is missing
> >> required attribute: name
> >> >   - line: 2 column: 12{file:
> >> >
> >>
> file:///E:/java/JProjects/CastorJDO00/database.xml;
> >> line: 2; column: 12}
> >> > 
> >> > As far as I can see this parser expects name
> >> attribute in the databases
> >> > element too?!? 
> >> > I've tried renaming databases element to
> something
> >> else but the same
> >> > error is reported.
> >> 
> >> Emir,
> >> 
> >> Do you have the DOCTYPE delcaration in the
> database
> >> descriptor? The 
> >> DOCTYPE delcaration usually looks like the
> >> following:
> >> 
> >> <!DOCTYPE databases PUBLIC
> >>      "-//EXOLAB/Castor JDO Configuration DTD
> Version
> >> 1.0//EN"
> >>      "http://castor.exolab.org/jdo-conf.dtd";>
> >> 
> >> Notice that it already contains the <databases>
> >> element in the DOCTYPE 
> >> descriptor. In this case, you can leave the
> explicit
> >> <databases> and 
> >> </databases> elements out of your database
> >> descriptor.
> >> 
> >> Bruce
> >> -- 
> >> perl -e 'print 
> >>
> >
>
unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'
> >> 
> >> The Castor Project
> >> http://www.castor.org/
> >> 
> >> Apache Geronimo
> >>
> http://incubator.apache.org/projects/geronimo.html
> >> 
> >>
> >
>
-----------------------------------------------------------
> >> 
> >> If you wish to unsubscribe from this mailing,
> send
> >> mail to
> >> [EMAIL PROTECTED] with a subject of:
> >>         unsubscribe castor-dev
> >> 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Finance Tax Center - File online. File on
> time.
> > http://taxes.yahoo.com/filing.html
> > 
> >
>
-----------------------------------------------------------
> 
> > If you wish to unsubscribe from this mailing, send
> mail to
> > [EMAIL PROTECTED] with a subject of:
> >         unsubscribe castor-dev
> > 
> > 
> 
> 
> 
> /*---------*\
> |*    ec    *|
> \*---------*/  
> ________________________________
> 15 Mbytes Free Web-based and  POP3
> Sign up now: http://www.gawab.com
> 
>
-----------------------------------------------------------
> 
> If you wish to unsubscribe from this mailing, send
> mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to