Menu

#26 There's no mapping for Oracle's DATE type.

open
nobody
None
5
2006-06-14
2006-06-14
Anonymous
No

given test case:

<test name="date">
<sql>
<stmt>select sysdate from dual</stmt>
</sql>
<result echo="true">
</result>
</test>

breaks down with message:

Setting up test...
(0ms)
At ${result[1,1,1]}, could not convert
java.sql.Timestamp returned from database to DATE(91)
Tearing down test...

Discussion

  • Sujit Pal

    Sujit Pal - 2006-06-14

    Logged In: YES
    user_id=184803

    So it looks like Oracle.DATE needs to be mapped to
    javax.sql.Timestamp, which is currently mapped to
    TimestampType. You can make the addition in the
    types.properties yourself and it should just work (check the
    user guide for how to do it).

    I will also put this in this weekend and check in to CVS (if
    I have time, which looks unlikely at the moment, else
    sometime next week).

    -sujit

     
  • Nobody/Anonymous

    Logged In: NO

    How to map the java.date to oracle date type.

     
  • Nobody/Anonymous

    Logged In: NO

    The message is saying that sysdate is being returned from
    the database as java.sql.Timestamp and is being treated by
    SQLUnit as a java.sql.Date, based on the mapping in etc/
    types.properties.

    I notice that the mapping is already there per CVS revision
    1.3 of types.properties. I suspect that the vendor name is
    something other than oracle. If the database vendor name
    (from Connection.getMetaData().getVendorName()) is other
    than oracle, then we will need to add a mapping for that.

    Another workaround is to explicitly specify a vendor name
    in the connection which does not have an explicit mapping,
    so DATE would map to the default mapping java.sql.Date.

    Please check to see the vendor name and let me know so I
    can add the mapping. If it is "oracle", this bug has
    already been fixed.

     

Log in to post a comment.