aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes problem creating tables using ant + ddl utils for oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "problem creating tables using ant + ddl utils for oracle" Watch "problem creating tables using ant + ddl utils for oracle" New topic
Author

problem creating tables using ant + ddl utils for oracle

Avinash Ga
Ranch Hand

Joined: Aug 13, 2011
Posts: 78

Hi Ranchers,

i want to create a schema from xml using Apach DDLUtils + ant. i followed the tutorial mentioned here but unable to create the schema.

my DbSchema.xml file is like.....



my build.xml file looks like this....


when i run the script i got this error....

db-setup:
[echo] starting database setup.........
[echo] ------------------------------------------
[echo] database type selected is oracle
[echo] database connection url is jdbcracle:thin:@localhost:1521:xe
[echo] username for database is avinash
[echo] password for database is avinash
[echo] driver detected for connection is oracle.jdbc.driver.OracleDriver
[echo] ------------------------------------------
[ddlToDatabase] Read schema file /home/avinash/My Data/Java/WorkSpaces/bikers-coders/swing-varsity/SwingVarsity/Platform/database-setup/DatabaseSchema.xml
[ddlToDatabase] Borrowed connection jdbcracle:thin:@localhost:1521:xe, UserName=AVINASH, Oracle JDBC driver from data source
[ddlToDatabase] Returning connection jdbcracle:thin:@localhost:1521:xe, UserName=AVINASH, Oracle JDBC driver to data source.
[ddlToDatabase] Remaining connections: None


can anyone help me with this. it would be very helpful if anyone give me code to create schema in oracle using DDLUtils + ant.

Regards,
--
Avinash


Avinash G.A
OCP Java SE 6 Programmer, OCP Java EE 5 Web Component Developer, OCE Java EE 6 Web Services Developer, VMware Certified Core Spring 3.x Developer, EMC Proven Professional (ISM-V2)
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5837
    
    7

Have you tried running Ant with the -v option to see if you get more details? Ire there any options to turn on tracing within ddlToDatabase?


JBoss In Action
Avinash Ga
Ranch Hand

Joined: Aug 13, 2011
Posts: 78

Thanks Peter i have got the stack trace........ i think its related to DDLUtils, may be something wrong with my configuration...... i will try to find the issue..... thanks again......


at org.apache.ddlutils.task.Command.handleException(Command.java:81)
at org.apache.ddlutils.task.WriteSchemaToDatabaseCommand.execute(WriteSchemaToDatabaseCommand.java:135)
at org.apache.ddlutils.task.DatabaseTaskBase.executeCommands(DatabaseTaskBase.java:337)
at org.apache.ddlutils.task.DatabaseTaskBase.execute(DatabaseTaskBase.java:365)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:474)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: org.apache.ddlutils.model.ModelException: Unknown JDBC type code 2009
at org.apache.ddlutils.model.Column.setTypeCode(Column.java:215)
at org.apache.ddlutils.platform.JdbcModelReader.readColumn(JdbcModelReader.java:781)
at org.apache.ddlutils.platform.oracle.Oracle8ModelReader.readColumn(Oracle8ModelReader.java:117)
at org.apache.ddlutils.platform.JdbcModelReader.readColumns(JdbcModelReader.java:755)
at org.apache.ddlutils.platform.JdbcModelReader.readTable(JdbcModelReader.java:565)
at org.apache.ddlutils.platform.oracle.Oracle8ModelReader.readTable(Oracle8ModelReader.java:102)
at org.apache.ddlutils.platform.JdbcModelReader.readTables(JdbcModelReader.java:516)
at org.apache.ddlutils.platform.JdbcModelReader.getDatabase(JdbcModelReader.java:472)
at org.apache.ddlutils.platform.JdbcModelReader.getDatabase(JdbcModelReader.java:432)
at org.apache.ddlutils.platform.PlatformImplBase.readModelFromDatabase(PlatformImplBase.java:1884)
at org.apache.ddlutils.platform.PlatformImplBase.getAlterTablesSql(PlatformImplBase.java:615)
at org.apache.ddlutils.platform.PlatformImplBase.alterTables(PlatformImplBase.java:604)
at org.apache.ddlutils.platform.PlatformImplBase.alterTables(PlatformImplBase.java:541)
at org.apache.ddlutils.task.WriteSchemaToDatabaseCommand.execute(WriteSchemaToDatabaseCommand.java:118)
... 19 more
Avinash Ga
Ranch Hand

Joined: Aug 13, 2011
Posts: 78

SOLVED!!! i was missing a schemapattern attribute in ddltodatabase task. thank peter.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem creating tables using ant + ddl utils for oracle