Loading ...
Sorry, an error occurred while loading the content.

Transfer: Invalid numeric value

Expand Messages
  • Helen Cheng
    Hi Ronald, All: I m running the Transfer program on Windows NT 4.0 with SOLID database, Oracle xmlparser and JDK 1.1.8. I got the exception
    Message 1 of 2 , Apr 7 12:12 PM
    • 0 Attachment
      Hi Ronald, All:

      I'm running the Transfer program on Windows NT 4.0 with SOLID
      database, Oracle xmlparser and JDK 1.1.8.

      I got the exception "java.sql.SQLException: Invalid numeric value."

      I'm enclosing a short test case here. I'd really appreciate for any
      suggestions and ideas that can help me with this problem.

      Here is my test.dtd:

      <?xml version="1.0" encoding="UTF-8"?>
      <!ELEMENT test (MibTMDefaultPolicy*)>
      <!ELEMENT MibTMDefaultPolicy EMPTY>
      <!ATTLIST MibTMDefaultPolicy scale CDATA #REQUIRED>

      Here is the test.map that was generated from GenerateMap, except I
      made all the Column Name uppercase because SOLID convert column names
      to uppercase.

      <?xml version="1.0" ?>
      <!DOCTYPE XMLToDBMS SYSTEM "xmldbms.dtd" >

      <XMLToDBMS Version="1.0">
      <Options>
      </Options>
      <Maps>
      <ClassMap>
      <ElementType Name="MibTMDefaultPolicy"/>
      <ToClassTable>
      <Table Name="MibTMDefaultPolicy"/>
      </ToClassTable>
      <PropertyMap>
      <Attribute Name="scale"/>
      <ToColumn>
      <Column Name="SCALE"/>
      </ToColumn>
      </PropertyMap>
      </ClassMap>
      <ClassMap>
      <ElementType Name="test"/>
      <ToRootTable>
      <Table Name="test"/>
      <CandidateKey Generate="Yes">
      <Column Name="TESTID"/>
      </CandidateKey>
      <OrderColumn Name="TESTORDER" Generate="Yes"/>
      </ToRootTable>
      <RelatedClass KeyInParentTable="Candidate">
      <ElementType Name="MibTMDefaultPolicy"/>
      <CandidateKey Generate="Yes">
      <Column Name="TESTID"/>
      </CandidateKey>
      <ForeignKey>
      <Column Name="TESTID"/>
      </ForeignKey>
      <OrderColumn Name="MIBTMDEFAULTPOLICYORDER"
      Generate="Yes"/>
      </RelatedClass>
      </ClassMap>
      </Maps>
      </XMLToDBMS>


      Here is the test.sql I used to create the tables before running
      Transfer:

      Drop Table test;
      Drop Table MibTMDefaultPolicy;
      Drop Table XMLDBMSKEY;
      commit work;
      CREATE TABLE XMLDBMSKEY ("HighKey" INTEGER);
      insert into XMLDBMSKEY values ('0');
      commit work;
      CREATE TABLE MibTMDefaultPolicy (
      "MibTMDefaultPolicyOrder" INTEGER,
      "testID" INTEGER,
      "scale" VARCHAR(255)
      );
      commit work;
      CREATE TABLE test (
      "testOrder" INTEGER,
      "testID" INTEGER);
      commit work;

      Here is my test.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE test SYSTEM "test.dtd" >
      <test>
      <MibTMDefaultPolicy scale = "100.0" />
      </test>

      Here is the exception. I'm printing out some values for my debugging:

      java Transfer -todbms test.map test.xml
      Finished initializing key generator
      Creating Map object test.map
      mapFilename = test.map
      Finished creating Map object
      number = 3 type = 4value = 100.0
      java.sql.SQLException: Invalid numeric value: 100.0
      at java.lang.Throwable.<init>(Compiled Code)
      at java.lang.Exception.<init>(Compiled Code)
      at java.sql.SQLException.<init>(SQLException.java:82)
      at de.tudarmstadt.ito.xmldbms.Parameters.setStringParameter
      (Parameters.java:1022)
      at de.tudarmstadt.ito.xmldbms.Parameters.setParameter
      (Parameters.java:157)
      at de.tudarmstadt.ito.xmldbms.Parameters.setParameters
      (Compiled Code)
      at de.tudarmstadt.ito.xmldbms.DOMToDBMS.insertRow
      (DOMToDBMS.java:681)
      at de.tudarmstadt.ito.xmldbms.DOMToDBMS.createClassRow
      (DOMToDBMS.java:350)
      at de.tudarmstadt.ito.xmldbms.DOMToDBMS.processFKNodes
      (Compiled Code)
      at de.tudarmstadt.ito.xmldbms.DOMToDBMS.createClassRow
      (DOMToDBMS.java:351)
      at de.tudarmstadt.ito.xmldbms.DOMToDBMS.processRootElement
      (DOMToDBMS.java:307)
      at de.tudarmstadt.ito.xmldbms.DOMToDBMS.processRoot(Compiled
      Code)
      at de.tudarmstadt.ito.xmldbms.DOMToDBMS.storeDocument
      (DOMToDBMS.java:236)
      at Transfer.toDBMS(Transfer.java:132)
      at Transfer.main(Compiled Code)

      Again thanks in advance for any suggestions.

      Helen Cheng
      helen_cheng@...
    • Helen Cheng
      Hi Ronald and All, Does anyone know where is the part of code (or API) in the Transfer program that reads database tables and determines column types? I found
      Message 2 of 2 , Apr 10 1:03 PM
      • 0 Attachment
        Hi Ronald and All,

        Does anyone know where is the part of code (or API) in the Transfer
        program that reads database tables and determines column types?

        I found one solution to my problem, but I'd be interested in digging
        into the code a little more just to be sure I'm solving the problem
        properly.

        Here is what I found. The problem has something to do with the name
        of my attribute, i.e. "scale" in this case. If I change "scale" to
        say "sscale", then Transfer works fine. I wonder why "scale" is
        being determined as numberic column vs. varchar which was the way
        that I created it.

        Thanks in advance for any suggestions and information.

        Helen
      Your message has been successfully submitted and would be delivered to recipients shortly.