Yes, Thank you. That was it. I have another question now...


I modified the example that came with the distribution to reflect my own
environment, so here is the constructor for my Test.java class. I think
that I have set everything up correctly:



   public Test( PrintWriter writer )
        throws Exception
    {
        // Load the mapping file
        _mapping = new Mapping( getClass().getClassLoader() );
        _mapping.setLogWriter( writer );
        _mapping.loadMapping( getClass().getResource( MappingFile ) );

        _jdo = new JDO();
        _jdo.setLogWriter( writer );
        _jdo.setConfiguration( getClass().getResource( DatabaseFile
).toString() );
        _jdo.setDatabaseName( "SAMPLE" );

    }

However, I get the following error:

[jdoTest] Loading mapping descriptors from
file:/C:/Eclipse/eclipse/workspace/DataBinding/jdoTest/department.xml
[jdoTest] SQL for creating jdoTest.generated.Department: INSERT INTO
department (deptno,deptname,mgrno,admrdept,location) VALUES (?,?,?,?,?)
[jdoTest] SQL for deleting jdoTest.generated.Department: DELETE FROM
department WHERE deptno=?
[jdoTest] SQL for updating jdoTest.generated.Department: UPDATE department
SET deptname=?,mgrno=?,admrdept=?,location=? WHERE deptno=? AND deptname=?
AND mgrno=? AND admrdept=? AND location=?
[jdoTest] SQL for loading jdoTest.generated.Department:  SELECT
department.deptname,department.mgrno,department.admrdept,department.location

FROM department WHERE department.deptno=?
[jdoTest] org.exolab.castor.jdo.DatabaseNotFoundException: No configuration
loaded for database SAMPLE -- use the JDO interface to load a configuration
for this database
[jdoTest] org.exolab.castor.jdo.DatabaseNotFoundException: No configuration
loaded for database SAMPLE -- use the JDO interface to load a configuration
for this database
[jdoTest]   at org.exolab.castor.jdo.engine.DatabaseImpl.<init>(Unknown
Source)
[jdoTest]   at org.exolab.castor.jdo.JDO.getDatabase(Unknown Source)
[jdoTest]   at jdoTest.Test.run(Test.java:87)
[jdoTest]   at jdoTest.Test.main(Test.java:58)

As you can see, it finds the the department.xml file and creates the SQL,
but it doesn't seem to recognize the database that I have set up.

Any help would be appreciated.

Thanks,
Ray





                                                                                       
                                                   
                      Mickael Guessant                                                 
                                                   
                      <mickael.guessant@fi        To:       [EMAIL PROTECTED]      
                                                   
                      system.com>                 cc:       (bcc: Ray 
Grieselhuber/Teamwork)                                              
                                                  Subject:  Re: [castor-dev] DB2 
Mapping Question                                         
                      07/17/2002 01:10 PM                                              
                                                   
                      Please respond to                                                
                                                   
                      castor-dev                                                       
                                                   
                                                                                       
                                                   
                                                                                       
                                                   





Maybe with a class-name instead of class in the driver tag ?

The following database.xml file is working fine :
<!DOCTYPE databases PUBLIC
  "-//EXOLAB/Castor JDO Configuration DTD Version 1.0//EN"
  "http://castor.exolab.org/jdo-conf.dtd";>
<database name="default" engine="db2" >
             <driver class-name="COM.ibm.db2.jdbc.app.DB2Driver"
          url="jdbc:db2:TEST">
    <param name="user" value="db2admin" />
    <param name="password" value="db2admin" />
  </driver>
  <mapping href="mapping.xml" />
</database>

[EMAIL PROTECTED] a �crit :
>
> I am attempting to set up Castor JDO to connect to a DB2 Database.
However,
> I get the following exception:
>
> [jdoTest] Loading mapping descriptors from
> file:/C:/Eclipse/eclipse/workspace/DataBinding/jdoTest/department.xml
> [jdoTest] org.exolab.castor.jdo.DatabaseNotFoundException: Nested error:
> java.sql.SQLException: No suitable driver
> [jdoTest] java.sql.SQLException: No suitable driver
> [jdoTest]   at java.sql.DriverManager.getDriver(Unknown Source)
> [jdoTest]   at
> org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(Unknown
Source)
> [jdoTest]   at org.exolab.castor.jdo.JDO.getDatabase(Unknown Source)
> [jdoTest]   at jdoTest.Test.run(Test.java:86)
> [jdoTest]   at jdoTest.Test.main(Test.java:58)
>
> I have the DB2 driver loaded in my classpath.
> Here is my database file:
>
> <database name="sample" engine="db2">
>       <driver class="COM.ibm.db2.jdbc.app.DB2Driver" url
="jdbc:db2:SAMPLE">
>             <param name="user" value="db2user" />
>             <param name="password" value="db2password" />
>       </driver>
>       <mapping href="department.xml" />
> </database>
>
> Here is my mapping:
>
> <!DOCTYPE databases PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
>                            "http://castor.exolab.org/mapping.dtd";>
> <mapping>
>
>   <!--  Mapping for Department -->
>   <class name="jdoTest.generated.Department"
>          identity="deptno">
>     <description>Department</description>
>     <map-to table="department" xml="department" />
>     <field name="deptno" type="string" >
>       <sql name="deptno" type="char" dirty="check" />
>       <xml node="text"/>
>     </field>
>     <field name="deptname" type="string">
>       <sql name="deptname" type="varchar" dirty="check" />
>       <xml node="text" />
>     </field>
>      <field name="mgrno" type="string">
>       <sql name="mgrno" type="char" dirty="check" />
>       <xml node="text" />
>     </field>
>      <field name="admrdept" type="string">
>       <sql name="admrdept" type="char" dirty="check" />
>       <xml node="text" />
>     </field>
>      <field name="location" type="string">
>       <sql name="location" type="char" dirty="check" />
>       <xml node="text" />
>     </field>
>   </class>
>
> </mapping>
>
> Thanks in advance!
>
> Best,
> Ray
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

--
Mickael Guessant
Consultant Architecture Distribu�e
Fi System France - http://www.fisystem.com
mailto:[EMAIL PROTECTED]

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

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

Reply via email to