Thanks for replying.

i used another variant of the read function, the one that takes an
inputsource, but am not sure that the code i added is sufficient to make it
work. The exception no longer appears but nothing happens. I assume no
reading occurs. That's the whole thing.

  String  nameoffile= "H:\\xmltodb.xml";
        // File xmlfile= new File(nameoffile);

int x;

try {
    // Declare the file input stream.
    InputStream fis = new FileInputStream(nameoffile);

    // Read in x from the file.  If not EOF then print x out.
    while ((x = fis.read())!= -1) {
        System.out.print(x);

    }

         InputSource insource= new InputSource(fis);


        Database targetModel = new DatabaseIO().read(insource);

        BasicDataSource dataSource = new BasicDataSource();
        dataSource.setUrl("jdbc:derby://localhost:1527/instancedb");
        dataSource.setDriverClassName("org.apache.derby.jdbc.ClientDriver");

        boolean    alterDb = false;

        Platform platform = PlatformFactory.createNewPlatformInstance
(dataSource);

        if (alterDb) {
            platform.alterTables(targetModel, false);
        } else {

            platform.createTables(targetModel, true, true);
        }
} catch (Exception e) {
    System.out.print(e.getMessage());
}

i found someone else on this alias who had the same problem
(MalFormedURLException). You see, the problem is that when i run this code
in netbeans java application it works, but as i include it inside a module,
it gives this exception. That other guy i guess had a similar problem in
eclipse. he said that he tired everything, including using other variants of
the read method but the problem didn't go away except when he included
database.dtd and mapping.xml files in ddluitls.jar. Can this be relevant
too? and if that's the case, how can i find these files?

Thanks in advance

Wessam



On 9/18/07, Thomas Dudziak <[EMAIL PROTECTED]> wrote:
>
> On 9/18/07, Wessam Abd Rabo <[EMAIL PROTECTED]> wrote:
>
> > The following piece of code creates a MalFormedUrl exception. I just
> read
> > from an XML file and create a database. This is error Trace:
> >
> > org.apache.ddlutils.DdlUtilsException: java.net.MalformedURLException
> >  at org.apache.ddlutils.io.DatabaseIO.read(DatabaseIO.java:172)
> >
> >
> > This is the only code i write:
> >
> >  String  nameoffile= "xmltodb.xml";
> >         Database targetModel = new DatabaseIO().read(nameoffile);
> >
> >         BasicDataSource dataSource = new BasicDataSource();
> >         dataSource.setUrl("jdbc:derby://localhost:1527/instancedb");
> >         dataSource.setDriverClassName("
> org.apache.derby.jdbc.ClientDriver ");
> >
> >         boolean    alterDb = false;
> >
> >         Platform platform = PlatformFactory.createNewPlatformInstance
> > (dataSource);
> >
> >         if (alterDb) {
> >             platform.alterTables(targetModel, false);
> >         } else {
> >
> >             platform.createTables(targetModel, true, true);
> >         }
>
> Try a different variant of the read method with e.g. a FileInputStream
> that you opened for the xmltodb.xml file.
>
> Tom
>

Reply via email to