db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Moritz Kammerer (JIRA)" <j...@apache.org>
Subject [jira] Created: (DDLUTILS-266) Writing data from file to database
Date Tue, 30 Nov 2010 12:28:10 GMT
Writing data from file to database

                 Key: DDLUTILS-266
                 URL: https://issues.apache.org/jira/browse/DDLUTILS-266
             Project: DdlUtils
          Issue Type: Bug
          Components: Ant Tasks
            Reporter: Moritz Kammerer
            Assignee: Thomas Dudziak

When you try to write data from a xml file into the database using the ant-task <ddlToDatabase>
you'll get a "java.net.MalformedURLException: unknown protocol: " exception.
For example this task: 
		<ddlToDatabase usedelimitedsqlidentifiers="true" schemafile="db-schema.xml">
			<database url="jdbc:derby:directory:C:/Temp/derbydb;create=true;" driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
			<createDatabase failonerror="false" />
			<writeSchemaToDatabase />
			<writeDataToDatabase failonerror="false" datafile="data.xml" />

Here i get a "java.net.MalformedURLException: unknown protocol: d" exception.

Problem is the code

                getDataIO().writeDataToDatabase(reader, dataFile.getAbsolutePath());
                _log.info("Written data from file " + dataFile.getAbsolutePath() + " to database");

in WriteDataToDatabaseCommand.java. writeDataToDatabase uses the second argument to call the
method parse on a Digester object. This object interpretes the argument as an URI, trying
to use the D from "D:/..." as a protocol identifier.

I fixed this with a quick-and-dirty hack:

                getDataIO().writeDataToDatabase(reader, "file:///" + dataFile.getAbsolutePath());
                _log.info("Written data from file " + dataFile.getAbsolutePath() + " to database");

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message