When using PreparedStatement‘s setObject method for a column of type TEXT (in a MySQL DB), what should the last parameter be?
For example, I know that this is ok for a VARCHAR column:
stmt.setObject(i, "bla", Types.VARCHAR);
where stmt is a PreparedStatement, and Types is java.sql.Types.
But if the DB column’s type is TEXT, should I still use VARCHAR? or maybe BLOB, or CLOB?
The answer (YES, you are meant to use VARCHAR) can be found here:
http://dev.mysql.com/doc/connector-j/en/connector-j-reference-type-conversions.html (updated outdated broken link)
and here is some info about the MYSQL
TEXTtypehttp://dev.mysql.com/doc/refman/5.0/en/blob.html