db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jun Li <allanju...@gmail.com>
Subject Re: Problem with reading XML.
Date Wed, 08 Feb 2006 23:31:58 GMT
On 2/8/06, Thomas Dudziak <tomdzk@gmail.com> wrote:
>
> On 2/8/06, Jun Li <allanjunli@gmail.com> wrote:
>
> > Just tried ddlutils today. The XML it generates from database looks
> greate.
> > But I have problem with reading XML.
> > When I was trying to read the XML file generated back to an empty
> > database(SQL Server), there are exceptions which say: The column nr 5 in
> > table XXX has no type. However, the XML file really had type attribute
> and
> > value for all the columns.
>
> Please post some more info, e.g. the stacktrace and generated model.


OK, Here is the info.

XML schema:
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database.dtd">
  <database name="build">
    <table name="Accrual">
      <column name="AccrualID" primaryKey="true" required="true"
type="NUMERIC" size="8" autoIncrement="false"/>
      <column name="PeriodFK" primaryKey="false" required="true"
type="NUMERIC" size="8" autoIncrement="false"/>
      <column name="FileName" primaryKey="false" required="true"
type="VARCHAR" size="50" autoIncrement="false"/>
      <column name="AccruedByFK" primaryKey="false" required="true"
type="NUMERIC" size="8" autoIncrement="false"/>
      <column name="AccruedOn" primaryKey="false" required="true"
type="TIMESTAMP" size="23" autoIncrement="false"/>
      <foreign-key foreignTable="Employee" name="FK_Accrual_Employee">
        <reference local="AccruedByFK" foreign="EmployeeID"/>
      </foreign-key>
      <foreign-key foreignTable="Period" name="FK_Accrual_Period">
        <reference local="PeriodFK" foreign="PeriodID"/>
      </foreign-key>
      <unique name="PK_Accrual">
        <unique-column name="AccrualID"/>
      </unique>
      <index name="IX_Accrual_Employee">
        <index-column name="AccruedByFK"/>
      </index>
      <index name="IX_Accrual_Period">
        <index-column name="PeriodFK"/>
      </index>
    </table>

Here are the exceptions:

........

9/02/2006 09:57:04 org.apache.commons.betwixt.expression.Context popOptions

INFO: Cannot pop options off empty stack

9/02/2006 09:57:04 org.apache.commons.betwixt.expression.Context popOptions

INFO: Cannot pop options off empty stack

9/02/2006 09:57:04 org.apache.commons.betwixt.expression.Context popOptions

INFO: Cannot pop options off empty stack

Exception in thread "main" *org.apache.ddlutils.model.ModelException*: The
column nr. 5 in table Accrual has no type

at org.apache.ddlutils.model.Database.initialize(*Database.java:301*)

at org.apache.ddlutils.io.DatabaseIO.read(*DatabaseIO.java:152*)

at Engine.db2xmlEngine.readDatabaseFromXML(*db2xmlEngine.java:61*)

at Engine.db2xmlEngine.writeXMLToDatabase(*db2xmlEngine.java:65*)

at Engine.db2xmlEngine.main(*db2xmlEngine.java:42*)


> Another problem, I also tied to read a database into model and then write
> to
> > an empty database. The exceptions are as follow.
> >
> > Exception in thread "main" *org.apache.ddlutils.DynaSqlException*: Error
> > while executing SQL CREATE TABLE "EventSource"
> > (
> > "EventSourceID" NUMERIC(9,0) NOT NULL,
> > "EventSourceTypeFK" NUMERIC(9,0) NOT NULL,
> > "Name" VARCHAR(100) NOT NULL,
> > "LoggedBy" VARCHAR(50) DEFAULT 'N'iCMS'' NOT NULL,
>
> Here's the problem: the default value string contains a single
> apostroph which also is the quotation sign which naturally gives
> problems.
> In short, the apostroph needs to be escaped (DdlUtils does not yet do
> that but I have added issue DDLUTILS-66).
> If you have control over the schema (its not auto-generated), then for
> now please add the escape character yourself in the default value
> (sorry, don't now it for Sql Server right now).

<snip>
>
> > Can anyone give me some confidence that ddlutils really works on SQL
> Server.
> > I mean can create tables, insert records from reading XML file which
> > generated from other databases.
>
> I'm currently working on the Sql Server part, should be ready in a
> couple of days.
> Btw, what version of Sql Server and JDBC driver are you using ?
>
> Tom
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message