Thursday, March 26, 2015

SDL Tridion: Items might fail to deploy with message: ' org.hibernate.exception.DataException: String or binary data would be truncated'


Regardless of the SDL Tridion version you are running on, when deploying items, you might experience the following message:

org.hibernate.exception.DataException: String or binary data would be truncated
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1493) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:390) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:340) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400) ~[sqljdbc4.jar:na]
(…)



In the occasions that I have come across this error message, it was due to the transport package containing multimedia components with Russian characters. The title of these multimedia components then contains non-legal characters for the URL which requires the URL encoding to convert the title into a readable URL. To accomplish that, it will introduce more characters and then exceeding the character 255 character limit. This limit is set at both file system and database levels.

To overcome this error message and publish the items successfully, you can choose one of the following options: 
  •  Avoid non-legal characters in the file names; 
  • Decrease the length of the file name.

No comments: