You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-user@db.apache.org by Anas Mughal <an...@bluenog.com> on 2008/04/25 21:17:26 UTC

Data not written to Oracle

I am trying to load data into Oracle using DDLUtils Ant task. The task
reports that the data is successfully written to the database. However, I do
not see any data in Oracle. I don't understand what I am doing wrong! Please
help.

 

 

C:\workshop\DDLUtils>ant

Buildfile: build.xml

 

database-setup:

[ddlToDatabase] Read schema file C:\etc\schema\phase1-schema.xml

[ddlToDatabase] Read schema file C:\etc\schema\phase2-schema.xml

[ddlToDatabase] Read schema file C:\etc\schema\prefs-schema.xml

[ddlToDatabase] Read schema file C:\etc\schema\registry-schema.xml

[ddlToDatabase] Read schema file C:\etc\schema\security-schema.xml

[ddlToDatabase] Borrowed connection
org.apache.commons.dbcp.PoolableConnection@1ae90c from data source

[ddlToDatabase] Written data from file C:\etc\sql\j2-seed.xml to database

 

BUILD SUCCESSFUL

Total time: 2 seconds

 

 

 

Here is my Ant target:

 

 

 

<target name="database-setup"  description="Creates the database structure
and inserts data into the database">

 

                 <taskdef name="ddlToDatabase"
classname="org.apache.ddlutils.task.DdlToDatabaseTask">

                              <classpath refid="runtime-classpath"/>

                 </taskdef>

 

               <ddlToDatabase  databasetype="oracle" verbosity="debug">

                              <database url="${db-url}"

                                             driverClassName="${db-driver}"

                                             username="${db-username}"

                                             password="${db-password}" />

                              <fileset dir="${db-schema-path}">

                                             <include
name="phase1-schema.xml" />

                                             <include
name="phase2-schema.xml" />

                                             <include
name="phase3ojb-schema.xmll" />

                                             <include
name="prefs-schema.xml" />

                                             <include
name="registry-schema.xml" />

                                             <include
name="security-schema.xml" />

                              </fileset>

                              <!-- <createDatabase failonerror="false" />
-->

                              <!-- <writeSchemaToDatabase /> --> 

                              

                              <writeDataToDatabase
datafile="${db-data-file}"/>  

                                  

               </ddlToDatabase>

 

</target>

 

 

 

Thank you for help.

--

Anas Mughal

 

 

 


RE: Data not written to Oracle

Posted by Anas Mughal <an...@bluenog.com>.
Looking thru the source code, I see that the method
DatabaseDataIO::writeDataToDatabase is called from WriteDataToDatabase
class. The implementation of DatabaseDataIO::writeDataToDatabase is:



public void writeDataToDatabase(DataReader dataReader, String path) throws
DdlUtilsException {
        try        {
            dataReader.parse(path);
        }
        catch (Exception ex) { throw new DdlUtilsException(ex); }
}



The method apparently only reads the data. It does not seem to write
anything to the database. After calling this method, the code has a log
message that reports that data has been written to the database.

This seems to be the implementation of the Ant target writeDataToDatabase.
Could someone please let me know if they have used the Ant target
writeDataToDatabase to actually populate any database with data. I might be
missing something.

Best Regards.
--
Anas Mughal






-----Original Message-----
From: Anas Mughal [mailto:anas.mughal@bluenog.com] 
Sent: Friday, April 25, 2008 3:17 PM
To: ddlutils-user@db.apache.org
Subject: Data not written to Oracle

I am trying to load data into Oracle using DDLUtils Ant task. The task
reports that the data is successfully written to the database. However, I do
not see any data in Oracle. I don't understand what I am doing wrong! Please
help.

 

 

C:\workshop\DDLUtils>ant

Buildfile: build.xml

 

database-setup:

[ddlToDatabase] Read schema file C:\etc\schema\phase1-schema.xml

[ddlToDatabase] Read schema file C:\etc\schema\phase2-schema.xml

[ddlToDatabase] Read schema file C:\etc\schema\prefs-schema.xml

[ddlToDatabase] Read schema file C:\etc\schema\registry-schema.xml

[ddlToDatabase] Read schema file C:\etc\schema\security-schema.xml

[ddlToDatabase] Borrowed connection
org.apache.commons.dbcp.PoolableConnection@1ae90c from data source

[ddlToDatabase] Written data from file C:\etc\sql\j2-seed.xml to database

 

BUILD SUCCESSFUL

Total time: 2 seconds

 

 

 

Here is my Ant target:

 

 

 

<target name="database-setup"  description="Creates the database structure
and inserts data into the database">

 

                 <taskdef name="ddlToDatabase"
classname="org.apache.ddlutils.task.DdlToDatabaseTask">

                              <classpath refid="runtime-classpath"/>

                 </taskdef>

 

               <ddlToDatabase  databasetype="oracle" verbosity="debug">

                              <database url="${db-url}"

                                             driverClassName="${db-driver}"

                                             username="${db-username}"

                                             password="${db-password}" />

                              <fileset dir="${db-schema-path}">

                                             <include
name="phase1-schema.xml" />

                                             <include
name="phase2-schema.xml" />

                                             <include
name="phase3ojb-schema.xmll" />

                                             <include
name="prefs-schema.xml" />

                                             <include
name="registry-schema.xml" />

                                             <include
name="security-schema.xml" />

                              </fileset>

                              <!-- <createDatabase failonerror="false" />
-->

                              <!-- <writeSchemaToDatabase /> --> 

                              

                              <writeDataToDatabase
datafile="${db-data-file}"/>  

                                  

               </ddlToDatabase>

 

</target>

 

 

 

Thank you for help.

--

Anas Mughal