db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Davis <da...@guydavis.ca>
Subject Re: Oracle 9i generating empty schema file for DatabaseToDdlTask
Date Mon, 06 Feb 2006 22:11:17 GMT
Thanks for the tips Tom.  Unfortunately, I'm still getting an empty 
schema.xml file when using the Ant task.  Here's my Ant task now:

	<target name="db.clean" description="Reset the configured database to 
base install.">
		<taskdef name="db_to_ddl" classpath="../ddlutils/target/classes" 
classname="org.apache.ddlutils.task.DatabaseToDdlTask">
			<classpath>
				<path refid="build.app.classpath" />
				<pathelement location="../ddlutils/target/classes" />
				<path>
					<fileset dir="../ddlutils/lib">
						<include name="**/*.jar" />
						<include name="**/*.zip" />
					</fileset>
				</path>
			</classpath>
		</taskdef>

		<db_to_ddl schema="DV_MASTER" databaseType="Oracle9">
			<database url="jdbc:oracle:thin:@//INTDB002:1521/INTDEV01"
				driverClassName="oracle.jdbc.driver.OracleDriver"
				username="DV_MASTER" password="password" />
			<writeSchemaToFile outputFile="schema.xml" />
		</db_to_ddl>
	</target>

I also wrote a short JUnit test that does a similar thing, but this one 
works.  I get the DDL written to the file in schema.xml.  I can't figure 
out what the difference is:

public Database readDatabase(DataSource dataSource)
			throws DynaSqlException, SQLException {
		Platform platform = PlatformFactory
				.createNewPlatformInstance(dataSource);
		return platform.readModelFromDatabase(dataSource.getConnection(), null,
				null, "DV_MASTER", null);
	}

	public void testWriteDb() throws Exception {
		OracleDataSource dataSource = new OracleDataSource();
		dataSource.setURL("jdbc:oracle:thin:@//INTDB002:1521/INTDEV01");
		dataSource.setUser("DV_MASTER");
		dataSource.setPassword("password");

		Database db = readDatabase(dataSource);
		new DatabaseIO().write(db, new FileWriter(new File("schema.xml")));
	}

DDLUtils integration with Ant is what made me give it a try.  I'd really 
like to know what I'm doing wrong with the Ant task...

Thanks,
Guy

Thomas Dudziak wrote:
> On 2/4/06, Guy Davis <davis@guydavis.ca> wrote:
> 
> 
>>I'm trying to generate a DDL XML file from our current database.  Here's
>>my target from build.xml.  The target runs with no errors but the output
>>file is empty.  Any ideas?
> 
> 
> At first glance, this seems to a problem with rights. You should check
> that you have the necessary rights to *see* the tables in the schema
> DV_MASTER.
> With Oracle, it is also helpful to explicitly specify the platform to
> use because there are three different ones (8, 9, 10 with 8 the
> default) that differ. I.e. for an Oracle9 database:
> 
> <db_to_ddl schema="DV_MASTER" databaseType="Oracle9">
> 
> It might also be helpful to run Ant with the -v or the -debug switches
> in order to get more info about the Ant run.
> 
> Tom



Mime
View raw message