Still faulty in jTDS 1.3.1 ... :-( This is a really bad bug, as generic code gets broken when the datatype changes from datetime to date! Generic code is dependent on correct datatypes. String is the worst type - our workaround is just a guess by parsing the string if it could be a date value.
I don't understand what is so difficult about this? It would be at least much better if you handle Date as Datetime. Much better than string.
Last edit: m.hilpert 2013-07-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
jTDS 1.3.1 ... I've fallen foul of this twice recently, once using javax.persistence.AttributeConverter mapping to/from entities with JPA, and secondly in some generic code that was looking at the column type in java.sql.DatabaseMetaData. Both were expecting java.sql.Date and were working fine with other JDBC drivers.
Duplicate of feature request #78. I'm aware of the problem, but still have no idea how to fix that.
Cheers,
momo
Still faulty in jTDS 1.3.1 ... :-( This is a really bad bug, as generic code gets broken when the datatype changes from datetime to date! Generic code is dependent on correct datatypes. String is the worst type - our workaround is just a guess by parsing the string if it could be a date value.
I don't understand what is so difficult about this? It would be at least much better if you handle Date as Datetime. Much better than string.
Last edit: m.hilpert 2013-07-22
jTDS 1.3.1 ... I've fallen foul of this twice recently, once using javax.persistence.AttributeConverter mapping to/from entities with JPA, and secondly in some generic code that was looking at the column type in java.sql.DatabaseMetaData. Both were expecting java.sql.Date and were working fine with other JDBC drivers.
It looks like the MS JDBC driver supports conversion correctly (according to their web site)
https://msdn.microsoft.com/en-us/library/ms378878(v=sql.110).aspx
Is there any news regarding a fix in jTDS?
I just ran into this same bug in our application. The MS SQL column of type date is returned as a varchar (int=12).
Can we help on solving this?
The fix is easy:
I'd provide a PR but it seems that the project is not alive anymore :-/
Edit: Feel free to use my patch: https://github.com/bi-web/jTDS/commit/9c463aaf3a77d3b5870404837a019d812af7aaa3
It's partial, I passed typeInfo only at the places where it was already in a variable. There are 2 more placed, I added a FIXME comment there..
Last edit: Michael Wyraz 2019-03-22