Menu

oracle dates - again.

Pat Worth
2006-06-30
2013-04-25
  • Pat Worth

    Pat Worth - 2006-06-30

    I am sorry for not being able to figure this out on my own. trust me, i have tried.
    i have an SP that returns a couple of cursors. i have successfully setup and called the proc. when processing the results, i am getting this error:

      [sqlunit]  ${result[1,1,1]}, could not convert java.sql.Date returned from database to oracle.DATE(91)

    I am confused why a conversion to oracle.DATE is happening when processing results. if the native type being returned is a java.sql.Date, why convert?

    anyway i have attempted to debug the SQLUnit code and have found no place to jump into the debugger.

    can you please shed some light and maybe point me in the right direction with this. is there some mapping that i need to set up somewhere?

    regards,
    pat

     
    • Sujit Pal

      Sujit Pal - 2006-06-30

      Hi Pat,

      Are you running Oracle? At some point in the past, Oracle would return a java.sql.Timestamp for SQL DATE fields, which was accomodated for by adding an oracle.DATE type to types.properties.

      The way SQLUnit figures out whether to use oracle.DATE instead of DATE is by checking the vendorName from the DatabaseMetaData object. You can work around this by explicitly specifying the vendor name in the connection element (check the dtd for the exact attribute name), say vendor="oracle_10g" or something.

      Since SQLUnit will not find a definition for oracle_10g.DATE in types.properties, it will try to use the standard mapping for DATE which is java.sql.Date and which your server is returning.

      -sujit

       
      • Pat Worth

        Pat Worth - 2006-06-30

        Sujit,

        thanks for your quick reply. yes. i am using oracle 10. i managed to get the code in the debugger and figured out the mapping. i had an inkling that the problem was the mapping, but i saw the thread on the explicit Timestamp mapping posted some time ago and didn't trust my gut at first.

        i made the appropriate (un) mapping in usertypes.properties and things are working now. i think i may follow your advise about the vendor name on the connection.

        regards,
        pat.
        ---

         
        • Sujit Pal

          Sujit Pal - 2006-06-30

          Hi Pat,

          Thanks for the feedback. I was reading something related this morning (after I sent out the last post) and apparently, newer versions of Oracle have this as a configurable parameter, it can return Date or Timestamp depending on how it is configured.

          Another avenue to explore, if practical.

          -sujit

           

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.