SQL exception when accessing Teradata DATE

Developers
2009-10-20
2013-04-29
  • Leszek Bednarz

    Leszek Bednarz - 2009-10-20

    I am using SQL Explorer as Eclipse plugin to connect to Teradata 12 via the JDBC driver 13.00.00.07.
    I have observed a problem when accessing DATE datatype, e.g.:

    select DATE '2009-01-01';

    raises the following exception:
    java.sql.SQLException: :TeraResultSet:getTimeStamp function failed

    In the source code of the sqlexplorer project I have seen that getTimestamp() is used to retrieve the data from the ResultSet for DATE and TIMESTAMP. Apparently the Teradata JDBC driver does not like it.
    When I use getDate() for DATE, everything works fine.

    The affected class is "net.sourceforge.sqlexplorer.dataset.DataSet", method "loadCellValue".
    Here is the code piece (updated for Teradata):

            case Types.DATE:
            return resultSet.getDate(columnIndex);
            case Types.TIMESTAMP:  
            return resultSet.getTimestamp(columnIndex);

    My question is, what is the reason for using getTimestamp() for DATE, respectively is there any disadvantage in using getDate()?

    Leszek

     
  • Heiko Hilbert

    Heiko Hilbert - 2009-10-27

    I added your changes to current CVS. I tested it with MySql, Postgres and MsSql and found no problems. As I could see, DATE is returned if only a date value is selected, timestamp if date and time value is returned. Some databases make no differences between date and timestamp.
    I don't know Teradata,perhaps it has only separate date and time values and does not support timestamp?

     
  • Heiko Hilbert

    Heiko Hilbert - 2009-10-28

    3.5.1 SR1 is released with your change included. Update your installation and check if it is ok.

     
  • Leszek Bednarz

    Leszek Bednarz - 2009-10-28

    Thanks for the new relese. It works fine.<br>
    Regarding Teradata it supports date, time, and timestamp.

     

Log in to post a comment.