You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by "Moritz Kammerer (JIRA)" <ji...@apache.org> on 2010/11/30 13:28:10 UTC
[jira] Created: (DDLUTILS-266) Writing data from file to database
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" />
</ddlToDatabase>
Here i get a "java.net.MalformedURLException: unknown protocol: d" exception.
Problem is the code
try
{
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:
try
{
getDataIO().writeDataToDatabase(reader, "file:///" + dataFile.getAbsolutePath()); // THIS LINE HAS CHANGED
_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.