db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Dudziak" <tom...@gmail.com>
Subject Re: issue with schema being ignored
Date Sun, 16 Apr 2006 23:26:59 GMT
On 4/14/06, Jim Vester <jimvester@gmail.com> wrote:


> > I have a  derby Database named myDatabase.
> > The database contains a schema rentabike.
> > the schema contains a table named bikes.
> >
> > when I use the DatabaseToDdlTask to try
> > and unload the schema and data, schema="rentabike" catalog=""
> > userid="user" password="pass", an error occurs.
> >
> > The schema is extracted successfully however the data is not.
> >
> > Here is a snippet of the stack trace:
> > org.apache.ddlutils.DynaSqlException : Error while performing a query
> >         at org.apache.ddlutils.platform.PlatformImplBase.query
> > (PlatformImplBase.
> > java:793)
> >         at org.apache.ddlutils.task.WriteDataToFileCommand.execute
> > (WriteDataToFi
> > leCommand.java :82)
> >         at org.apache.ddlutils.task.DatabaseTaskBase.executeCommands
> > (DatabaseTas
> > kBase.java:198)
> >         at org.apache.ddlutils.task.DatabaseTaskBase.execute(
> > DatabaseTaskBase.ja
> > va:222)
> >         at org.apache.tools.ant.UnknownElement.execute (
> > UnknownElement.java:275)
> >         at org.apache.tools.ant.Task.perform(Task.java:364)
> >         at org.apache.tools.ant.Target.execute(Target.java:341)
> >         at org.apache.tools.ant.Target.performTasks(Target.java :369)
> >         at org.apache.tools.ant.Project.executeSortedTargets(Project.java
> > :1216)
> >         at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
> >         at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
> > cutor.java:40)
> >         at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
> >         at org.apache.tools.ant.Main.runBuild(Main.java:668)
> >         at org.apache.tools.ant.Main.startAnt(Main.java :187)
> >         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
> >         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
> > Caused by: org.apache.derby.client.am.SqlException: Schema 'user' does not
> > exist
> >         at org.apache.derby.client.am.Statement.completeSqlca(Unknown
> > Source)
> >         at org.apache.derby.client.net.NetStatementReply.parsePrepareError
> > (Unkno
> > wn Source)
> >         at
> > org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply (Unk
> > nown Source)
> >         at
> > org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutp
> > ut(Unknown Source)
> >         at
> > org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(
> > Unknown Source)
> >         at
> > org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(U
> > nknown Source)
> >         at org.apache.derby.client.am.Statement.readPrepareDescribeOutput
> > (Unknow
> > n Source)
> >         at org.apache.derby.client.am.Statement.flowExecute (Unknown
> > Source)
> >         at org.apache.derby.client.am.Statement.executeQueryX(Unknown
> > Source)
> >         at org.apache.derby.client.am.Statement.executeQuery(Unknown
> > Source)
> >         at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingSt
> > atement.java:205)
> >         at org.apache.ddlutils.platform.PlatformImplBase.query
> > (PlatformImplBase.
> > java:787)
> >
> > I think it is occuring because the generated sql from the
> > WritDataToFileCommand.execute
> >
> > does not take into account the schema name. Note userid is added in front
> > of table names by default.
> >
> >  writer.write(platform.query(model, "select * from "+tables[0].getName(),
> > tables));
> >
> >  The correct sql is select * from schema.table. or select * from
> > rentabike.bikes
> >
> >  I had a similar issue with DB2, again with schema, however it failed
> > earlier in
> >  determineAutoIncrementFromResultSetMetaData(...)
> >  ...
> >          query.append (" FROM ");
> >          if (getPlatform().isDelimitedIdentifierModeOn())
> >          {
> >              query.append(getPlatformInfo().getDelimiterToken());
> >          }
> >          query.append(table.getName());
> >
> >
> > the schema is again missing... I hacked it by checking if a schemaName
> > existed in the table
> > object and appending the table.getSchema() [?] +"." then the table name.
> >
> > Should a jira bug be opened or is there a simpliler way to provide the
> > fully qualifed table name?

Well, yes, schema support is somewhat lacking yet, you safest bet
currently is to prefix the table names in the XML with the schema
name. But this is obviously not a good solution in the long run.
Please feel free to open two issues (one for the Derby one, and one
for the Db2 one as it is a different spot).

Tom

Mime
View raw message