I have a test case where I bind current time (milliseconds) and it fails with [Error 6760] [SQLState HY000] Invalid timestamp.
My question is do I have to take care of some timestamp formatting before I bind it with setTimestamp method of PreparedStatment ? Or is this a knwon issue and I can expect a solution for it?
Here is the test case details:
a) Teradata Database: V2R.06.02.02.93
b) Teradata JDBC: 14.00.00.09
c) Binding in a query: AND (DA."DAY_DT" BETWEEN ? AND ? )
d) Column definition for DAY_DT: DAY_DT TIMESTAMP(0)
e) Java Test Case:
java.sql.Connection conn = null;
java.sql.PreparedStatement ps = null;
java.sql.ResultSet rs = null;
long currTime = (new java.util.Date()).getTime();
conn = // getting connection from your Teradata..
ps = conn.prepareStatement(newSql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY );
ps.setTimestamp(1, new java.sql.Timestamp(currTime));
ps.setTimestamp(2, new java.sql.Timestamp(currTime));
rs = ps.executeQuery(); //<== Error raised in here..
I just tested binding java.sql.Timestamp values to the question-mark parameter markers in a BETWEEN ? AND ? condition, using Teradata Database V2R06.02.02.67, and it worked successfully.
The Teradata Database Error 6760 "Invalid Timestamp" may be occurring for some other reason.
To troubleshoot further, we would need DDL, sample data, and Teradata JDBC Driver debug logs -- which is too much information for this forum.
If you're a customer, please open an incident with Customer Support, and we can proceed from there.
Thank you Tom.
I will ask the end-user to open an incident with Customer Support.