title: Truncating strings
body: <p>I'm working with third party user data that may or may not fit into our database. The data needs to be truncated if it is too long.</p>
  
  <p>We are using IBatis with Connector/J. If the data is too long a SQL exception is thrown. I have had two choices: either truncate the strings in Java or truncate the strings in sql using substring. </p>
  
  <p>I don't like truncating the strings in sql, because I am writing table structure in our Ibatis XML, but SQL on the other hand knows about our database collation (which isn't consistent and would be expensive to make consistent) and can truncate string in a multibyte safe manner. </p>
  
  <p>Is there a way to have the Connector/J just straight insert this SQL and if not which route would people recommend?</p>