jTDS incorrectly reports data type info in result set metadata (for DATE columns, reports NVARCHAR)

后端 未结 1 1193
逝去的感伤
逝去的感伤 2021-01-22 23:11

Currently, the jTDS JDBC driver (1.2.5) against Microsoft SQL Server 2008 appears to incorrectly report the data type for DATE columns as NVARCHAR.

It probably behaves

1条回答
  •  清酒与你
    2021-01-22 23:56

    I found a solution with the condition

    metaData.getColumnType(columnNumber) == 12

    if this condition is satisfied, execute the query

    SELECT System_Type_Id FROM Sys.Columns WHERE Name = [column name] AND Object_Id = (SELECT Object_Id FROM Sys.Tables WHERE Name = [table name])

    for smalldatetime it will return 58

    and for datetime it will return 61.

    0 讨论(0)
提交回复
热议问题