Error selecting Date when using jdbc

Connectivity
N/A

Error selecting Date when using jdbc

I have a table with a few columns of DATE type. I am able to select data from this table using BTEQwin. However, as soon as I use something which connects via the jdbc driver I get the message "TeraResultSet:getTimestamp function failed".

I am using driver 12.00.00.107.

This error turns up both when I connect using the SQL Explorer plugin in Eclipse and through my application which is running in Tomcat (and uses hibernate, if that matters).

I found a workaround by casting to a timestamp and then a char(10) like so:

(cast(cast(m_.misson_date as Timestamp(0)) as char(10)))

However, I am also forced to have String as my type in hibernate instead of Date.

Is there something I can do to make this work while preserving the Date type?
4 REPLIES
Teradata Employee

Re: Error selecting Date when using jdbc

Please post the stack trace for the exception that you got.
Thanks,
--Tom
N/A

Re: Error selecting Date when using jdbc

here is a error I am getting :

java.sql.SQLException: [Teradata JDBC Driver] [TeraJDBC 13.00.00.07] [Error 618] [SQLState HY000] TeraResultSet:getTimeStamp function failed
at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeLegacyDriverException(ErrorFactory.java:150) [terajdbc4.jar:13.00.00.07]
at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeLegacyDriverException(ErrorFactory.java:144) [terajdbc4.jar:13.00.00.07]
at com.teradata.jdbc.ComUtil.ThrowExcp(ComUtil.java:1537) [terajdbc4.jar:13.00.00.07]
at com.teradata.jdbc.TeraResultSet.getTimestamp(TeraResultSet.java:4265) [terajdbc4.jar:13.00.00.07]
at com.teradata.jdbc.jdbc_3.ifjdbc_4.TeraLocalResultSet.getTimestamp(TeraLocalResultSet.java:923) [terajdbc4.jar:13.00.00.07]
at com.teradata.jdbc.jdbc_3.ifjdbc_4.TeraLocalResultSet.getTimestamp(TeraLocalResultSet.java:602) [terajdbc4.jar:13.00.00.07]
at org.hibernate.type.TimestampType.get(TimestampType.java:53) [hibernate3.jar:na]

for java.util.Date (java) / DATE (teradata)
Teradata Employee

Re: Error selecting Date when using jdbc

Teradata JDBC Driver version 13.00.00.07 and earlier versions of the Teradata JDBC Driver do not support the implicit data type conversion of calling ResultSet.getTimestamp for a DATE column value.

You have two possible solutions:

1. Upgrade to Teradata JDBC Driver version 13.00.00.16, which does provide implicit data type conversion of calling ResultSet.getTimestamp for a DATE column value.

2. As a workaround with older versions of the Teradata JDBC Driver, you can call ResultSet.getDate to obtain a DATE column value, thereby avoiding the unsupported implicit data type conversion.
N/A

Re: Error selecting Date when using jdbc

Thanks for the info. I am using version 13.00.00.27 and it seems to be working properly.