Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Ant Tasks
    • Labels:
      None

      Description

      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"); }

        Activity

          People

          • Assignee:
            Thomas Dudziak
            Reporter:
            Moritz Kammerer
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development