db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anas Mughal" <anas.mug...@bluenog.com>
Subject RE: Data not written to Oracle
Date Tue, 29 Apr 2008 14:34:54 GMT
Thank you very much for taking the time to answer my question.

By the way, the data successfully inserted by Jetspeed code. That code uses
DDLUtils internally. So, my data file should not have any issues.

Here is the output with DEBUG:

Buildfile: build.xml

[ddlToDatabase] Read schema file
[ddlToDatabase] Read schema file
[ddlToDatabase] Read schema file
[ddlToDatabase] Read schema file
[ddlToDatabase] Read schema file
[ddlToDatabase] Borrowed connection
org.apache.commons.dbcp.PoolableConnection@1ae90c from data source
[ddlToDatabase] Written data from file
C:\workshop\DDLUtils\oracle\etc\sql\j2-seed.xml to database

Total time: 2 seconds

My ant script is as follows:


<?xml version="1.0" encoding="UTF-8"?>

<project name="DDLUtilsTest" default="database-setup">
	<property name="db-url" value="jdbc:oracle:thin:@localhost:1521:xe"
	<property name="db-driver" value="oracle.jdbc.driver.OracleDriver"
	<property name="db-username" value="bluenogTest" />
	<property name="db-password" value="bluenog" />
	<property name="db-schema-path" value="etc/schema/" />
	<property name="db-data-file" value="etc/sql/j2-seed.xml" />

	<path id="runtime-classpath">
		<fileset dir="C:\Downloads\DDLUtils\DdlUtils-1.0-bin\lib">
			<include name="**/*.jar" />
location="C:\Programs\DDLUtils/DdlUtils-1.0.jar" />
		<pathelement location="C:\Programs\OracleJDBC/ojdbc14.jar"

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

	  <taskdef name="ddlToDatabase"
		<classpath refid="runtime-classpath"/>

	<ddlToDatabase  databasetype="oracle"
usedelimitedsqlidentifiers="true" verbosity="DEBUG">

		<database url="${db-url}"
			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" />

		<!-- <createDatabase failonerror="false" /> -->
		<!-- <writeSchemaToDatabase /> --> 		
		<writeDataToDatabase datafile="${db-data-file}" />  



Thank you very much for your help!

Anas Mughal
W: 732-733-1120  x114
C: 862-571-2437

-----Original Message-----
From: Thomas Dudziak [mailto:tomdzk@gmail.com] 
Sent: Tuesday, April 29, 2008 2:57 AM
To: ddlutils-user@db.apache.org
Subject: Re: Data not written to Oracle

On Mon, Apr 28, 2008 at 7:58 PM, Anas Mughal <anas.mughal@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)
>  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.

No, it does not. It reads data from XML and puts it into a sink, which
in this case is a database sink which inserts data into the DB (if it
Please run your Ant task with a verbosity setting of DEBUG and post
the output. Also if ensureforeignkeyorder is set to true (which is the
default), please check your data for foreign keys where the referenced
item is missing in the data XML (the output of the Ant task will print
how many of these DdlUtils encountered).


View raw message