#691 Add support for SQL 2008 'date' type

None
open
nobody
None
5
2013-02-08
2011-05-09
Anonymous
No

It seems that the new SQL 2008 'date' type is unsupported by the jTDS 1.2.4 driver. I didn't check the new 1.2.5 driver since it's not in Maven repo yet, but from the list of resolved issues it seems this issue was not addressed.

The jTDS 1.2.4 driver converts the 'date' type as java.lang.String but it should be 'java.sql.Date'. To reproduce this behavior, try to read a 'date' column from a result set by getObject(int) and you will receive a String. Also, when reading result set metadata with method getColumnClassName(int), String is returned.

eQui

Discussion

  • Andy Chia

    Andy Chia - 2011-10-17

    in jTDS 1.2.5, java.sql.Types.NCHAR and java.sql.Types.NVARCHAR are not supported, when call statement.registerOutParameter(1, java.sql.Types.NVARCHAR), there will throw java.sql.SQLException: Invalid java.sql.Types constant value -9 passed to set or update method. at net.sourceforge.jtds.jdbc.JtdsCallableStatement.registerOutParameter(JtdsCallableStatement.java:268), It would be a good feature to support all kinds of SQL Types

     
  • momo

    momo - 2012-10-06

    I'm still trying to understand the root of the problem. It's not that the driver wouldn't return DATE values as Date instances if sent as DATEs by the server, it's just that the SQL server only returns values of type VARCHAR for DATE and TIME values in the TDS stream...

    I cross-checked with Microsoft's own driver and it seems it's suffering from the same problem.

    I'll have an eye on this.

    Cheers,
    momo

     
    Last edit: momo 2012-10-06
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-11-13

    If JTDS driver supports for TDS 7.3+ protocol, SQL Server will return correct types, eg.:

    DATENTYPE = %x28 ; (introduced in TDS 7.3)
    TIMENTYPE = %x29 ; (introduced in TDS 7.3)
    DATETIME2NTYPE = %x2A ; (introduced in TDS 7.3)
    DATETIMEOFFSETNTYPE = %x2B ; (introduced in TDS 7.3)

    Cheers,
    Daroo

     
  • momo

    momo - 2013-02-08

    Ticket moved from /p/jtds/feature-requests/78/

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks