I have a table on MS SQL Server with a column having data type as date. I am using jtds.jar for JDBC connection with DB. I am taking DatabaseMetaData from Connection. While checking columns from DatabaseMetaData, I observed that
int iType = rsMeta.getInt("DATA_TYPE");
returns Column type as java.sql.Types.VARCHAR
which is a string and not date. but it also returns
String tmp = rsMeta.getString("TYPE_NAME");
type name as date.
But for Oracle, It returns the date datatype as java.sql.Types.DATE
.
Why is such a difference?
This is a known JTDS bug, see http://sourceforge.net/p/jtds/bugs/679/.
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");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With