#679 returned datatype for SQLServer type date is wrong.


The returned datatype for a SQLServer Date type is returned as a varchar with a length of 10. This is wrong, it should return as Sql.Date.

int iType = rsMeta.getInt("DATA_TYPE");
String tmp = rsMeta.getString("TYPE_NAME");


  • momo

    momo - 2012-10-12

    Duplicate of feature request #78. I'm aware of the problem, but still have no idea how to fix that.


  • momo

    momo - 2012-10-18
    • milestone: v2.x --> v1.3
  • momo

    momo - 2012-10-18
    • status: open --> accepted
    • assigned_to: momo
  • m.hilpert

    m.hilpert - 2013-07-22

    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
  • chris jones

    chris jones - 2016-09-28

    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)

    Is there any news regarding a fix in jTDS?

  • Arthur Borsboom

    Arthur Borsboom - 2016-10-05

    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?


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks