java.lang.ClassCastException: net.sourceforge.jtds.jdbc.ClobImpl cannot be...
Brought to you by:
ickzon
I noticed this while using jTDS 1.2.8. It might impact 1.3.1 as well.
I have a column set to varchar(MAX) NOT NULL.
I tried to retrieve the column from a ResultSet using the getObject() method to retrieve the column value and casted the result to a String.
It resulted in a java.lang.ClassCastException: net.sourceforge.jtds.jdbc.ClobImpl cannot be cast to java.lang.String.
I've tried other JDBC drivers such as i-net and Microsoft's without any issues.
Let me know if you have any questions.
Thanks,
Matt
Note that if you switch (String) rs.getObject("column") to rs.getString("column") it works fine, but you shouldn't get an exception from doing it the other way I wouldn't think.
Actually, it looks like all I needed was uselobs=false in this case and I don't have to change anything. Sorry for the confusion.