could not convert java.lang.Integer ???

chris snow
2005-05-02
2013-04-25
  • chris snow
    chris snow
    2005-05-02

    Does anyone know what the following means (I'm using sun jdbc odbc driver on Teradata)?

    Thanks in advance,

    Chris

      [sqlunit] Running test[1]: M_DQ_KPI_LONGITUDINAL AVG Revenue (0ms)
      [sqlunit] At ${result[1,1,11]}, could not convert java.lang.Integer returned from database to TINYINT(-6)

     
    • chris snow
      chris snow
      2005-05-02

      I've found a temporary workaround by casting the problem value into an integer:

      CAST(0 AS INTEGER) AS L1_LIMIT_REVENUE,

       
    • David Fishburn
      David Fishburn
      2005-05-02

      You might want to read through this section of the User's Guide:

      http://sqlunit.sourceforge.net/x3569.html

      For each of the supported databases, SQLUnit must be told what to expect for each of the various datatypes.

      You can see these defined in:
      sqlunit-cvs\build\net\sourceforge\sqlunit\types.properties

      The above section in the Help allows you to override (or add new settings) into a usertypes.properties.  So for each datatype Teradata can return that you get an error with, you should create these entries.  Once you have them all worked out, Sujit can add these permenantly to the types.properties.

      HTH,
      Dave

       
    • Alain
      Alain
      2005-09-28

      I am using mySQL v 5.0 which now supports stored procedures.
      I keep getting
      At ${result[1,1,11]}, could not convert java.lang.Long returned from database to INTEGER(4)
      for a result column that is of MySQL type INTEGER.
      Could someone please show me how I configure usertypes.properties or types.properties to correctly map this data type.
      The instructions are somewhat cryptic an example would help a lot.

      Many thanks

       
      • wfay
        wfay
        2005-10-11

        Post the Mysql stored proc code.
        Post the SQLUnit xml code.
        Then someone can help.

        Much easier to work off of your example (throwing the error) than attempt to recreate this bug from scratch...

         
    • Sujit Pal
      Sujit Pal
      2005-12-17

      Hi Chris/Alain:

      For Chris on Teradata:
      [sqlunit] At ${result[1,1,11]}, could not convert java.lang.Integer returned from database to TINYINT(-6)
      Looks like teradata is returning a Integer in this column, although its advertising that its a TINYINT, which is mapped by default to Byte. You want to remap this to INTEGER for teradata. So in types.properties:
      teradata.TINYINT.class = net.sourceforge.sqlunit.types.IntegerType
      teradata.TINYINT.type = -6

      When you did a CAST(), it actually sent back an Integer which got handled correctly by the default type mapping.

      The teradata prefix is the vendor name returned by your JDBC driver. There is a VendorNameTest.java which you can use as a template to find what the vendor name actually is.

      For Alain on MySQL 5.0:
      At ${result[1,1,11]}, could not convert java.lang.Long returned from database to INTEGER(4)
      for a result column that is of MySQL type INTEGER.

      Same deal as above, mysql 5.0 is returning a Long but advertising it as an INTEGER. Add the mapping to types.properties:
      mysql.INTEGER.class = net.sourceforge.sqlunit.types.LongType
      mysql.INTEGER.type = 4

      Double check the vendor name, MySQL may have decided to call it mysql5 with their new release.

      If this works, then please let me know, and I'll add this mapping to types.properties so its available in the next version.

      Thanks
      Sujit

       

  • Anonymous
    2011-05-27

    hi~sujit
    i try it in mysql, it works